README is outdated. Please check source code.
AdsKit
Installation
Swift Package Manager
...
dependencies: [
.package(url: "https://github.com/c128128/AdsKit.git", from: "2.0.0")
],
targets: [
.target(name: "MyProject", dependencies: ["AdsKit"])
]
...
Setup:
-
Follow
Update your Info.plist
from officialGoogle Mobile Ads SDK (iOS)
-
Follow
App Transport Security
Please note: App Tracking Transparency Request
will be made when Banner
, Interstitial
or Reward
will be first called.
AdsKit
support UMP
if it was configured in Admob
UI, and will fallback to Ads.tracking()
if UMP
return an error.
AdsKit
automatically readsadUnitID
fromInfo.plist
and automaticallypreload()
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>
Details:
-
AdsKit
will automatically check if minimum necessary settings are met, if not app will crash on startup. -
AdsKit
will automaticallypreload()
ads on app startup by default. Can be disabled, setGADAutoload
inInfo.plist
, of typeBoolean
toNO
. -
AdsKit
automatically will requestrequestTrackingAuthorization
onload()
. Please note:GADAutoload
==YES
(default), Tracking Permission will be shown on first app startup.GADAutoload
==NO
, Tracking Permission will be shown before callingBanner
,Interstitial
orReward
function.
Banner
Create a UIView
inherited from Banner
.
Don't forget to set the adUnitID
.
If you want to set Banner
only programmatically set empty string in Ad UnitID
in the Storyboard.
@IBOutlet private weak var _banner: Banner!
...
// To set the Banner programmatically
self._banner.setAdUnitID("ca-app-pub-3940256099942544/2934735716")
// To remove the Banner
self._banner.setAdUnitID(nil)
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.