# Functions

The following functions are available globally.
[## Inline Adaptive Sizes](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/Inline-Adaptive-Sizes)

- `


  ### [GADPortraitInlineAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADPortraitInlineAdaptiveBannerAdSizeWithWidth)


  ` Returns a GADAdSize with the given width and the device's portrait height. This ad size
  allows Google servers to choose an optimal ad size less than or equal to the returned size. The
  exact size of the ad returned is passed through the banner's ad size delegate and is indicated
  by the banner's intrinsicContentSize. This ad size is most suitable for ads intended for scroll
  views.

  #### Declaration

  Swift

      func portraitInlineAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADPortraitInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADLandscapeInlineAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADLandscapeInlineAdaptiveBannerAdSizeWithWidth)


  ` Returns a GADAdSize with the given width and the device's landscape height. This ad size
  allows Google servers to choose an optimal ad size less than or equal to the returned size. The
  exact size of the ad returned is passed through the banner's ad size delegate and is indicated
  by the banner's intrinsicContentSize. This ad size is most suitable for ads intended for scroll
  views.

  #### Declaration

  Swift

      func landscapeInlineAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADLandscapeInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth)


  ` Returns a GADAdSize with the given width and the device's height. This is a convenience
  function to return GADPortraitInlineAdaptiveBannerAdSizeWithWidth or
  GADLandscapeInlineAdaptiveBannerAdSizeWithWidth based on the current interface orientation.
  This function must be called on the main queue.

  #### Declaration

  Swift

      func currentOrientationInlineAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADCurrentOrientationInlineAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight)


  ` Returns a GADAdSize with the given width and max height. This ad size allows Google servers to
  choose an optimal ad size less than or equal to the returned size. The exact size of the ad
  returned is passed through the banner's ad size delegate and is indicated by the banner's
  intrinsicContentSize. This ad size is most suitable for ads intended for scroll views.

  #### Declaration

  Swift

      func inlineAdaptiveBanner(width: CGFloat, maxHeight: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADInlineAdaptiveBannerAdSizeWithWidthAndMaxHeight(CGFloat width,
                                                         CGFloat maxHeight)

  #### Parameters

  |---|---|
  | ` width ` | The ad width. |
  | ` maxHeight ` | The maximum height a loaded ad will have. Must be at least 32 px, but a max height of 50 px or higher is recommended. |

[## Anchored Adaptive Sizes](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/Anchored-Adaptive-Sizes)

- `


  ### [GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth)


  ` Returns a GADAdSize with the given width and a Google-optimized height to create a large banner
  ad. The size returned is suitable for use in a banner ad anchored near the top or bottom of your
  app. The height is never larger than 20% of the device's portrait height and is always between
  50-150 points. This function always returns the same height for any width / device combination.
  This function must be called on the main queue.

  #### Declaration

  Swift

      func largePortraitAnchoredAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth)


  ` Returns a GADAdSize with the given width and a Google-optimized height to create a large banner
  ad. The size returned is suitable for use in a banner ad anchored near the top or bottom of your
  app. The height is never larger than 20% of the device's landscape height and is always between
  50-150 points. This function always returns the same height for any width / device combination.
  This function must be called on the main queue.

  #### Declaration

  Swift

      func largeLandscapeAnchoredAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADLargeAnchoredAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADLargeAnchoredAdaptiveBannerAdSizeWithWidth)


  ` Returns a GADAdSize with the given width and a Google-optimized height. This is a convenience
  function to return GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth or
  GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth based on the current interface
  orientation. This function must be called on the main queue.

  #### Declaration

  Swift

      func largeAnchoredAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADLargeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)

[## Custom Sizes](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/Custom-Sizes)

- `


  ### [GADAdSizeFromCGSize](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADAdSizeFromCGSize)


  ` Returns a custom GADAdSize for the provided CGSize. Use this only if you require a non-standard
  size. Otherwise, use one of the standard size constants above.

  #### Declaration

  Swift

      func adSizeFor(cgSize size: CGSize) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADAdSizeFromCGSize(CGSize size)

- `


  ### [GADAdSizeFullWidthPortraitWithHeight](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADAdSizeFullWidthPortraitWithHeight)


  ` Returns a custom GADAdSize that spans the full width of the application in portrait orientation
  with the height provided.

  #### Declaration

  Swift

      func fullWidthPortrait(height: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADAdSizeFullWidthPortraitWithHeight(CGFloat height)

- `


  ### [GADAdSizeFullWidthLandscapeWithHeight](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADAdSizeFullWidthLandscapeWithHeight)


  ` Returns a custom GADAdSize that spans the full width of the application in landscape orientation
  with the height provided.

  #### Declaration

  Swift

      func fullWidthLandscape(height: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADAdSizeFullWidthLandscapeWithHeight(CGFloat height)

[## Convenience Functions](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/Convenience-Functions)

- `


  ### [GADAdSizeEqualToSize](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADAdSizeEqualToSize)


  ` Returns YES if the two GADAdSizes are equal, otherwise returns NO.

  #### Declaration

  Swift

      func isAdSizeEqualToSize(size1: AdSize, size2: AdSize) -> Bool

  Objective-C

      extern BOOL GADAdSizeEqualToSize(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size1, https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size2)

- `


  ### [IsGADAdSizeValid](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@IsGADAdSizeValid)


  ` Returns YES if \|size\| is one of the predefined constants or is a custom GADAdSize generated by
  GADAdSizeFromCGSize.

  #### Declaration

  Swift

      func isAdSizeValid(size: AdSize) -> Bool

  Objective-C

      extern BOOL IsGADAdSizeValid(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size)

- `


  ### [GADAdSizeIsFluid](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADAdSizeIsFluid)


  ` Returns YES if \|size\| is a fluid ad size.

  #### Declaration

  Swift

      func isAdSizeFluid(size: AdSize) -> Bool

  Objective-C

      extern BOOL GADAdSizeIsFluid(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size)

- `


  ### [CGSizeFromGADAdSize](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@CGSizeFromGADAdSize)


  ` Returns a CGSize for the provided a GADAdSize constant. If the GADAdSize is unknown, returns
  CGSizeZero.

  #### Declaration

  Swift

      func cgSize(for size: AdSize) -> CGSize

  Objective-C

      extern CGSize CGSizeFromGADAdSize(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size)

- `


  ### [NSStringFromGADAdSize](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@NSStringFromGADAdSize)


  ` Returns a NSString describing the provided GADAdSize.

  #### Declaration

  Swift

      func string(for size: AdSize) -> String

  Objective-C

      extern NSString *_Nonnull NSStringFromGADAdSize(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size)

- `


  ### [NSValueFromGADAdSize](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@NSValueFromGADAdSize)


  ` Returns an NSValue representing the GADAdSize.

  #### Declaration

  Swift

      func nsValue(for size: AdSize) -> NSValue

  Objective-C

      extern NSValue *_Nonnull NSValueFromGADAdSize(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize size)

- `


  ### [GADAdSizeFromNSValue](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADAdSizeFromNSValue)


  ` Returns a GADAdSize from an NSValue. Returns GADAdSizeInvalid if the value is not a GADAdSize.

  #### Declaration

  Swift

      func adSizeFor(nsValue value: NSValue) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADAdSizeFromNSValue(NSValue *_Nonnull value)

[## Deprecated](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/Deprecated)

- `


  ### [GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth)


  ` Deprecated

  Use GADLargePortraitAnchoredAdaptiveBannerAdSizeWithWidth instead.
  Returns a GADAdSize with the given width and a Google-optimized height to create a banner ad.
  The size returned has an aspect ratio similar to that of GADAdSizeBanner, suitable for
  anchoring near the top or bottom of your app. The height is never larger than 15% of the
  device's portrait height and is always between 50-90 points. This function always returns the
  same height for any width / device combination. This function must be called on the main queue.

  #### Declaration

  Swift

      func portraitAnchoredAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth)


  ` Deprecated

  Use GADLargeLandscapeAnchoredAdaptiveBannerAdSizeWithWidth instead.
  Returns a GADAdSize with the given width and a Google-optimized height to create a banner ad.
  The size returned is suitable for use in a banner ad anchored near the top or bottom of your
  app, similar to use of GADAdSizeBanner. The height is never larger than 15% of the device's
  landscape height and is always between 50-90 points. This function always returns the same
  height for any width / device combination. This function must be called on the main queue.

  #### Declaration

  Swift

      func landscapeAnchoredAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth)


  ` Deprecated

  Use GADLargeAnchoredAdaptiveBannerAdSizeWithWidth instead.
  Returns a GADAdSize with the given width and a Google-optimized height. This is a convenience
  function to return GADPortraitAnchoredAdaptiveBannerAdSizeWithWidth or
  GADLandscapeAnchoredAdaptiveBannerAdSizeWithWidth based on the current interface orientation.
  This function must be called on the main queue.

  #### Declaration

  Swift

      func currentOrientationAnchoredAdaptiveBanner(width: CGFloat) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(CGFloat width)

- `


  ### [GADClosestValidSizeForAdSizes](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADClosestValidSizeForAdSizes)


  ` Returns the closest valid ad size from possibleAdSizes as compared to \|original\|. The selected
  size must be smaller than or equal in size to the original. The selected size must also be
  within a configurable fraction of the width and height of the original. If no valid size exists,
  returns GADAdSizeInvalid.

  #### Declaration

  Swift

      func closestValidSizeForAdSizes(original: AdSize, possibleAdSizes: [NSValue]) -> AdSize

  Objective-C

      extern https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize
      GADClosestValidSizeForAdSizes(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADAdSize original,
                                    NSArray<NSValue *> *_Nonnull possibleAdSizes)

- `


  ### [GADGetStringFromVersionNumber](https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Functions#/c:@F@GADGetStringFromVersionNumber)


  ` Returns a string representation of the version number.

  #### Declaration

  Swift

      func string(for version: VersionNumber) -> String

  Objective-C

      NSString *_Nonnull GADGetStringFromVersionNumber(https://developers.google.com/ad-manager/mobile-ads-sdk/ios/api/reference/Structs/GADVersionNumber version)