CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.

ALManager 1.0.5

ALManager 1.0.5

Maintained by MTSDK.



 
Depends on:
MiTuKit>= 0
AppLovinSDK>= 0
SkeletonView>= 0
GoogleUserMessagingPlatform>= 0
 

ALManager 1.0.5

  • By
  • Mitu Ultra

ALManager

Version License Platform

About

HI,
ALManager is a lightweight library that helps developers structure and easily use Ads with AppLovin.

Installation with CocoaPods

To integrate MiTuKit into your Xcode project using CocoaPods, specify it in your Podfile:

target 'MyApp' do
  pod 'ALManager'
end

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but ALManager does support its use on supported platforms.

Once you have your Swift package set up, adding ALManager as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/hominhtuong/ALManager.git", .upToNextMajor(from: "0.0.1"))
]

Example code:

The code would look like this:
import ALManager

class ViewController: UIViewController {
    func setupAd() {
        Task {
            let adUnits = ALAdUnits(
                openAdUnitID: AdUnits.openAdUnitID,
                bannerAdUnitID: AdUnits.bannerAdUnitID,
                interstitialAdUnitID: AdUnits.interstitialAdUnitID,
                rewardAdID: AdUnits.rewardAdID
            )
            await ALManager.shared.setup(sdkKey: applovinSDKKey, units: adUnits)
            ALManager.shared.loadInterstitial()
            
            //...
        }
    }
}
    
Show Ads:
import ALManager

class ViewController: UIViewController {
    func nextScreen() {
        
        ALManager.shared.showInterstitial()
        self.navigationController?.pushViewController(NextScreen(), animated: true)
    }
    
    func showAdAndNextScreen() {
        ALManager.shared.showInterstitial { state in
            if state == .showed {
            } else {
                self.navigationController?.pushViewController(NextScreen(), animated: true)
            }
        }
    }
}
🔥 Important!!!!

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.

Banner Ads:
import ALManager

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()
        }
    }
}

License

ALManager is released under the MIT license. See LICENSE for details.

My website: Visit