GADPictureInPictureAd
@interface GADPictureInPictureAd : NSObjectA Picture-in-Picture (PiP) ad is a floating ad that overlays application content.
-
The unique identifier assigned to a specific ad placement in an app, created on the AdMob or Ad Manager UI.
Declaration
Swift
var adUnitID: String { get }Objective-C
@property (nonatomic, readonly, nonnull) NSString *adUnitID; -
Information about the ad response that returned the ad.
Declaration
Swift
var responseInfo: ResponseInfo { get }Objective-C
@property (nonatomic, readonly, nonnull) GADResponseInfo *responseInfo; -
Optional delegate to receive state change notifications.
Declaration
Swift
weak var delegate: (any PictureInPictureAdDelegate)? { get set }Objective-C
@property (nonatomic, weak, nullable) id<GADPictureInPictureAdDelegate> delegate; -
Executed when the ad is estimated to have earned money.
Declaration
Swift
var paidEventHandler: GADPaidEventHandler? { get set }Objective-C
@property (nonatomic, copy, nullable) GADPaidEventHandler paidEventHandler; -
The current position of the PiP ad. Value is
GADPictureInPictureAdPositionDefaultuntil the ad is assigned a position.Declaration
Swift
var position: PictureInPictureAdPosition { get }Objective-C
@property (nonatomic, readonly) GADPictureInPictureAdPosition position; -
The presentation scope of the PiP ad.
Declaration
Swift
var presentationScope: PictureInPictureAdPresentationScope { get }Objective-C
@property (nonatomic, readonly) GADPictureInPictureAdPresentationScope presentationScope; -
Unavailable
Unavailable. Use +loadWithAdUnitID:request:completionHandler: instead.
Declaration
Objective-C
- (nonnull instancetype)init; -
Loads a PiP ad.
Declaration
Swift
class func load(with adUnitID: String, request: Request?) async throws -> sending PictureInPictureAdObjective-C
+ (void)loadWithAdUnitID:(nonnull NSString *)adUnitID request:(nullable GADRequest *)request completionHandler:(nonnull GADPictureInPictureAdLoadCompletionHandler) completionHandler;Parameters
adUnitIDAn ad unit ID created in the AdMob or Ad Manager UI.
requestAn ad request object. If nil, a default ad request object is used.
completionHandlerA handler to execute when the load operation finishes or times out.
-
Shows the PiP ad on the screen using specified GADPictureInPictureAdOptions.
Declaration
Swift
@MainActor func show(with options: PictureInPictureAdOptions)Objective-C
- (void)showWithOptions:(nonnull GADPictureInPictureAdOptions *)options;Parameters
optionsThe options specifying presentation behavior. Must be called on the main thread.
-
Hides the PiP ad by removing it from the view hierarchy. Must be called on the main thread.
Declaration
Swift
@MainActor func hide()Objective-C
- (void)hide;