TyphoonRuntimeArguments

Objective-C

@interface TyphoonRuntimeArguments : NSObject <NSCopying>

+ (instancetype)argumentsFromInvocation:(NSInvocation *)invocation;

- (id)argumentValueAtIndex:(NSUInteger)index;

- (NSUInteger)indexOfArgumentWithKind:(Class)clazz;

- (void)enumerateArgumentsUsingBlock:(void(^)(id argument, NSUInteger index, BOOL *stop))block;

/** RuntimeArguments - arguments passed by user at runtime
*   ReferenceArguments - arguments specified in the assembly class
*
*   for example we have definition in the assembly
*
*   - (Person *)personWithFirstName:(NSString *)firstName lastName:(NSString *)lastName
*   {
*       return [TyphoonDefinition withClass:[Person class] configuration:^(TyphoonDefinition *definition) {
*           [definition injectProperty:@selector(firstName) with:firstName];
*           [definition injectProperty:@selector(lastName) with:lastName];
*       }];
*   }
*   Reference argument here is :
*   0 - TyphoonInjectionByRuntimeArgument at index 0
*   1 - TyphoonInjectionByRuntimeArgument at index 1
*
*   Runtime argument is:
*   0 - (NSString *) John
*   1 - (NSString *) Smith
*
*   This method return ReferenceArguments, but with replaced TyphoonInjectionByRuntimeArgument with runtime values
*   0 - TyphoonInjectionByRuntimeArgument at index 0 will be replaced by (NSString *)John
*   1 - TyphoonInjectionByRuntimeArgument at index 1 will be replaced by (NSString *)Smith
*   */
+ (TyphoonRuntimeArguments *)argumentsFromRuntimeArguments:(TyphoonRuntimeArguments *)runtimeArguments appliedToReferenceArguments:(TyphoonRuntimeArguments *)referenceArguments;

@end

Swift

class TyphoonRuntimeArguments : NSObject, NSCopying

Undocumented

  • Undocumented

    Declaration

    Objective-C

    + (instancetype)argumentsFromInvocation:(NSInvocation *)invocation;

    Swift

    convenience init!(from invocation: NSInvocation!)
  • Undocumented

    Declaration

    Objective-C

    - (id)argumentValueAtIndex:(NSUInteger)index;

    Swift

    func argumentValue(at index: UInt) -> Any!
  • Undocumented

    Declaration

    Objective-C

    - (NSUInteger)indexOfArgumentWithKind:(Class)clazz;

    Swift

    func indexOfArgument(withKind clazz: AnyClass!) -> UInt
  • Undocumented

    Declaration

    Objective-C

    - (void)enumerateArgumentsUsingBlock:(void(^)(id argument, NSUInteger index, BOOL *stop))block;

    Swift

    func enumerate(_ block: ((Any?, UInt, UnsafeMutablePointer<ObjCBool>?) -> Void)!)
  • RuntimeArguments - arguments passed by user at runtime

    • ReferenceArguments - arguments specified in the assembly class *
    • for example we have definition in the assembly *
    • - (Person *)personWithFirstName:(NSString *)firstName lastName:(NSString *)lastName
    • {
    • return [TyphoonDefinition withClass:[Person class] configuration:^(TyphoonDefinition *definition) {
    • [definition injectProperty:@selector(firstName) with:firstName];
    • [definition injectProperty:@selector(lastName) with:lastName];
    • }];
    • }
    • Reference argument here is :
    • 0 - TyphoonInjectionByRuntimeArgument at index 0
    • 1 - TyphoonInjectionByRuntimeArgument at index 1 *
    • Runtime argument is:
    • 0 - (NSString *) John
    • 1 - (NSString *) Smith *
    • This method return ReferenceArguments, but with replaced TyphoonInjectionByRuntimeArgument with runtime values
    • 0 - TyphoonInjectionByRuntimeArgument at index 0 will be replaced by (NSString *)John
    • 1 - TyphoonInjectionByRuntimeArgument at index 1 will be replaced by (NSString *)Smith *

    Declaration

    Objective-C

    + (TyphoonRuntimeArguments *)
        argumentsFromRuntimeArguments:(TyphoonRuntimeArguments *)runtimeArguments
          appliedToReferenceArguments:(TyphoonRuntimeArguments *)referenceArguments;

    Swift

    /*not inherited*/ init!(from runtimeArguments: TyphoonRuntimeArguments!, appliedToReferenceArguments referenceArguments: TyphoonRuntimeArguments!)