Add the AdMob Helper File

Helper files are great. They keep your code organized—and to some degree, modular—which is why you’ll be using a custom helper file here.

Open Finder and drag the AdMobHelper.swift file from the resources folder into the Project Navigator. Place it below the SpriteKitHelper.swift file, like so:

images/UsingAdsToIncreaseRevenue/ads-add-admob.png

Don’t forget to verify that the Copy items if needed and Add to targets options are both checked, and that the option to Create groups is selected.

Back in Xcode, open the AdMobHelper.swift file and have a look around. Yes, there’s a lot of code in this file, but don’t worry, what you’re seeing are the delegate method stubs for handling ads. You’ll learn about these methods and how to use them as you work through this chapter.

Now that you have the helper file loaded, it’s time to put it to work, starting with banner ads.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset