# ApptimizeCodeBlock

    @interface ApptimizeCodeBlock : NSObject

Wraps a code block with its corresponding name.

Useful in Swift for passing closures to `+runTest:withBaseline:apptimizeCodeBlocks:andOptions:`

- `name`

  Name to give this code block. Should match variant name associated with this code block.

  #### Declaration

  Objective-C

      @property (nonatomic, copy, nonnull) NSString *name;

  Swift

      var name: String { get set }

- `block`

  Code block to execute when enrolled in a variant matching `name`.

  #### Declaration

  Objective-C

      @property (nonatomic, copy, nonnull) void (^)(void) block;

  Swift

      var block: () -> Void { get set }

- `-initWithName:andBlock:`

  Initialize an ApptimizeCodeBlock that contains block and corresponding name

  #### Declaration

  Objective-C

      - (nonnull instancetype)initWithName:(nonnull NSString *)name
                                  andBlock:(nonnull void (^)(void))block;

  Swift

      init(name: String, andBlock block: @escaping () -> Void)

  #### Parameters

  `name` | The name of the code block, should match the variant name this code block is associated with.
  `block` | The code block to execute when enrolled in the variant matching `name`.

  #### Return Value

  Returns a new ApptimizeCodeBlock containing a named closure.

© 2025 Apptimize Inc.. All rights reserved. (Last updated: 2025-10-10)

Generated by jazzy ♪♫ v0.14.3, a Realm project.