Repository navigation
AdMobKit 2.0.0
🚀 The Next Big Thing: AdMobKit v2.0.0
SwiftUI + AdMob just got a massive upgrade. With lifecycle tracking, Combine-ready examples, and fine-tuned ad phase control, AdMobKit v2.0 is built to make your ad experience smoother and smarter.
🎉 What's New
✅ Unified Ad Lifecycle Phases
We introduced clean and extensible Equatable enums to represent ad lifecycle phases for all ad types:
BannerLifecycleEventFullScreenLifecycleEvent(used by Interstitial & App Open)RewardedLifecycleEvent(includes.reward(amount:))
These cover phases like:
.idle, .loading, .loaded, .impression, .click, .presenting, .willDismiss, .didDismiss, .failed(Error)This makes it much easier to track and react to ad states inside your SwiftUI app.
🧪 Combine Support Examples
While Combine observers are not built into the library, we now provide ready-to-use examples that show how to observe ad state (adPhase) reactively using Combine.
RewardedAdObserver(publisher: rewardedVM)These Combine observer examples:
- Subscribe to
@PublishedadPhaseupdates. - Log lifecycle transitions.
- Handle reward logic (e.g. coin increments) automatically.
- Help you keep ad logic out of your SwiftUI view layer.
Observer examples are provided for:
- Banner ads
- Interstitial ads
- Rewarded ads
- Rewarded Interstitial ads
- App Open ads
🧩 SwiftUI .onChange(of:) Compatibility
All ad lifecycle properties are @Published, so you can also track them directly in your views using .onChange(of:):
.onChange(of: bannerAdPhase) { phase in
print("Banner phase changed: \(phase)")
}💡 Why It Matters
- 🔁 Easier ad integration in SwiftUI using lifecycle-driven design.
- ✅ Better control over UI reactions to ad loading, failures, and interactions.
- 🪤 Cleaner separation of view and ad logic using Combine or
.onChange.