HI,
ALMHelper is a powerful Swift library designed to simplify Applovin MAX ad management. It provides:
✅ Easy Ad Loading & Displaying – Load and show Interstitial, Rewarded, Banner, Native, and Open Ads with minimal setup.
✅ Smart Delegation System – Improved delegate handling for cleaner and more maintainable code.
✅ Ad Frequency Control – Avoid ad spam with built-in frequency capping and impression percentage logic.
✅ GDPR & Privacy Compliance – Includes built-in tracking request and CMP handling.
⚡ ALMHelper – The ultimate tool for maximizing your Applovin MAX
ad revenue! 🚀
To integrate ALMHelper into your Xcode project using CocoaPods, specify it in your Podfile
target 'MyApp' do
pod 'ALMHelper'
end
Once you have your Swift package set up, adding ALMHelper as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/hominhtuong/ALMHelper.git", .upToNextMajor(from: "1.0.3"))
]
import ALMHelper
class SplashViewController: UIViewController {
func setupAd() {
Task {
let adUnits = ALAdUnits(
openAdUnitId: AdUnits.openAdUnitId,
bannerAdUnitId: AdUnits.bannerAdUnitId,
interstitialAdUnitId: AdUnits.interstitialAdUnitId,
rewardAdUnitId: AdUnits.rewardAdUnitId,
nativeAdUnitId: AdUnits.nativeAdUnitId
)
await ALMHelper.shared.setup(sdkKey: applovinSDKKey, units: adUnits)
//Load configs online then setup
ALMHelper.shared.configs.enableAds = true
ALMHelper.shared.configs.showInterstitial = true
//...
ALMHelper.shared.loadInterstitial()
//...
}
}
}
import ALMHelper
class ViewController: UIViewController {
func nextScreen() {
ALMHelper.shared.showInterstitial()
self.navigationController?.pushViewController(NextScreen(), animated: true)
}
func showAdThenNextScreen() {
ALMHelper.shared.showInterstitial { state in
if state == .showed { return }
self.navigationController?.pushViewController(NextScreen(), animated: true)
}
}
func showAdAndNextScreen() {
ALMHelper.shared.showInterstitial { state in
if state == .hidden { return }
self.navigationController?.pushViewController(NextScreen(), animated: false)
}
}
}
The state
from the completion handler in a successful case will be called twice
didDisplay
and didHide
(.showed and .hidden
).
You can navigate to another screen when state == .showed
while the interstitial is being presented (without affecting the user experience) or after it is dismissed with state == .hidden
.
import ALMHelper
class ViewController: UIViewController {
func setupView() {
let bannerView = UIView()
bannerView >>> view >>> {
$0.snp.makeConstraints {
$0.leading.trailing.equalToSuperview()
$0.bottom.equalTo(botSafe)
$0.height.equalTo(50)
}
$0.attachBanner()
}
}
}
extension ViewController: ALMHelperDelegate {
func didLoad(_ ad: MAAd) {
printDebug("ad: \(ad.adUnitIdentifier) didload")
}
func didFailToLoadAd(forAdUnitIdentifier adUnitIdentifier: String, withError error: MAError) {
printDebug("ad: \(adUnitIdentifier) didFailToLoadAd, withError: \(error.description)")
}
func didPayRevenue(for ad: MAAd) {
printDebug("ad: \(ad.adUnitIdentifier) didPayRevenue")
}
func interstitialAdShowCalled(for adUnitIdentifier: String, placement: String) {
printDebug("Add tracking: \(adUnitIdentifier) show called at \(placement)")
}
func showInterstitialAdSuccess(_ ad: MAAd, placement: String) {
printDebug("Add tracking: \(ad.adUnitIdentifier) show success at \(placement)")
}
func showInterstitialAdClick(_ ad: MAAd, placement: String) {
printDebug("Add tracking: \(ad.adUnitIdentifier) show click at \(placement)")
}
}
enum AdDisplayState {
case notReady
case failed
case showed
case hidden
case didReward(_ amount: Int)
ALMHelper is released under the MIT license. See LICENSE for more details.
My website: Visit