Swiftpack.co - c128128/AdsKit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by c128128.
c128128/AdsKit 1.3.3
A Swift library to display Google AdMob ads without pain.
⭐️ 0
🕓 1 week ago
iOS
.package(url: "https://github.com/c128128/AdsKit.git", from: "1.3.3")

AdsKit

Google Mobile Ads SDK (iOS) version 8.13.0, Release Notes, Latest SDK

Installation

Swift Package Manager

...

dependencies: [
    .package(url: "https://github.com/c128128/AdsKit.git", from: "1.0.0")
  ],
  targets: [
    .target(name: "MyProject", dependencies: ["AdsKit"])
  ]

...

Setup:

  1. Follow Update your Info.plist from official Google Mobile Ads SDK (iOS)

  2. Follow Request App Tracking Transparency authorization

  3. AdsKit automatically reads adUnitID from Info.plist and automatically preload() ads if needed.

<!-- example: Reward -->
<key>GADReward</key>
<string>ca-app-pub-3940256099942544/1712485313</string>

<!-- example: Interstitial -->
<key>GADInterstitial</key>
<string>ca-app-pub-3940256099942544/4411468910</string>

<!-- example: Banner -->
<key>GADBanner</key>
<string>ca-app-pub-3940256099942544/2934735716</string>

Details:

  • AdsKit will automatically check if minimum necessary settings are met, if not app will crash on startup.

  • AdsKit will automatically preload() ads on app startup by default. Can be disabled, set GADAutoload in Info.plist, of type Boolean to NO.

  • AdsKit automatically will request requestTrackingAuthorization on load(). Please note:

    • GADAutoload == YES (default), Tracking Permission will be shown on first app startup.
    • GADAutoload == NO, Tracking Permission will be shown before calling Banner, Interstitial or Reward function.

Banner

Banner automagically appear if GADBanner was defined in Info.plist with correct adUnitID.

If GADAutoload == NO, You need to call Ads.Google.banner(.show) to show the banner.

// Hide Banner
Ads.Google.banner(.remove)

// Show Banner
Ads.Google.banner(.show)

Interstitial

Interstitial. After ad was shown, new ad will be preloaded automatically.

Ads.Google.interstitial()
    .subscribe()

Reward

Reward. After ad was shown, new ad will be preloaded automatically.

Ads.Google.reward()
    .subscribe()

Reporting

Reporting. Subscribe to Ads.Google.report to observe events from Ad delegates.

Ads.Google.report
    .subscribe()

TODO

  • ☐ Add test devices.
  • ☐ Script to automatically download latest Google SDK.

GitHub

link
Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics