# IMACompanionAdSlot

    @interface IMACompanionAdSlot : NSObject

Ad slot for companion ads. The SDK will put a subview inside the provided
UIView container. The companion will be matched to the width and height
provided here. This class cannot be instantiated on tvOS, where companion ads
are not available.
- `


  ### [view](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Classes/IMACompanionAdSlot#/c:objc(cs)IMACompanionAdSlot(py)view)


  ` The view the companion will be rendered in. Display this view in your
  application before video ad starts.

  #### Declaration

  Swift

      var view: UIView { get }

  Objective-C

      @property (nonatomic, readonly) UIView *_Nonnull view;

- `


  ### [width](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Classes/IMACompanionAdSlot#/c:objc(cs)IMACompanionAdSlot(py)width)


  ` Width of the slot, in pixels. This value is sent to the DFP ad server for
  targeting.

  #### Declaration

  Swift

      var width: Int { get }

  Objective-C

      @property (nonatomic, readonly) NSInteger width;

- `


  ### [height](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Classes/IMACompanionAdSlot#/c:objc(cs)IMACompanionAdSlot(py)height)


  ` Height of the slot, in pixels. This value is sent to the DFP ad server for
  targeting.

  #### Declaration

  Swift

      var height: Int { get }

  Objective-C

      @property (nonatomic, readonly) NSInteger height;

- `


  ### [delegate](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Classes/IMACompanionAdSlot#/c:objc(cs)IMACompanionAdSlot(py)delegate)


  ` The IMACompanionDelegate for receiving events from the companion ad slot.

  #### Declaration

  Swift

      weak var delegate: (any https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Protocols/IMACompanionDelegate.html)? { get set }

  Objective-C

      @property (nonatomic, weak, nullable) id<https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Protocols/IMACompanionDelegate.html> delegate;

- `


  ### [-initWithView:width:height:](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Classes/IMACompanionAdSlot#/c:objc(cs)IMACompanionAdSlot(im)initWithView:width:height:)


  ` Initializes an instance of a IMACompanionAdSlot with design ad width and height.

  #### Declaration

  Swift

      init(view: UIView, width: Int, height: Int)

  Objective-C

      - (nonnull instancetype)initWithView:(nonnull UIView *)view
                                     width:(NSInteger)width
                                    height:(NSInteger)height;

  #### Parameters

  |---|---|
  | ` view ` | the UIView that will contain the companion ad |
  | ` width ` | the chosen width of the ad |
  | ` height ` | the chosen height of the ad |

  #### Return Value

  the IMACompanionAdSlot instance
- `


  ### [-initWithView:](https://developers.google.com/interactive-media-ads/docs/sdks/ios/client-side/reference/Classes/IMACompanionAdSlot#/c:objc(cs)IMACompanionAdSlot(im)initWithView:)


  ` Initializes an instance of a IMACompanionAdSlot with fluid size.

  #### Declaration

  Swift

      init(view: UIView)

  Objective-C

      - (nonnull instancetype)initWithView:(nonnull UIView *)view;

  #### Parameters

  |---|---|
  | ` view ` | the UIView that will contain the companion ad. |

  #### Return Value

  the IMACompanionAdSlot instance