Use the AdMob Helper for Banner Ads
To use the AdMob helper file, you first need to set up a struct to hold some static properties.
In the AdMobHelper.swift file, and after the import statements, add the following struct:
| struct AdMobHelper { |
| static let bannerAdDisplayTime: TimeInterval = 30 |
| static let bannerAdID = "ca-app-pub-3940256099942544/2934735716" // test id |
| } |
The first property is the time, in seconds, each banner ad will remain visible on the screen. The second property holds the ad unit ID. Because you’re still testing and developing the game, it’s best to use the ID shown in the example. See Using Test Ad Units for more information about testing ads.
Ultimately, you need to extend the functionality of the ...
Get Apple Game Frameworks and Technologies now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.