Ideally, we want to have our code completely dependency-free and preserve control over its entire functioning. In the real world, we know this is unrealistic since it would imply reinventing the wheel over and over.
AdsEngine centralizes the ad's SDKs and exposes them via facades.
Contracts expire, SDKs get deprecated and fees rises. These, just to mention a few, are valid reasons to change ad's vendors.
This is rather hard when our codebases are littered with direct SDKs implementations. AdsEngine makes such processes painless by making their consumption behind a facade. This is why, whatever happens under the hood shall not concern our clients apps.
https://github.com/GeekingwithMauri/AdsEngine
If you want to use AdsEngine in any other project that uses SwiftPM, add the package as a dependency in Package.swift
:
dependencies: [
.package(
url: "https://github.com/GeekingwithMauri/AdsEngine",
from: "0.1.0"
),
]
Within the desired place (usually a ViewController
) where an ad is going to be shown, add the following:
import AdsEngine
class SomeViewController {
private lazy var bannerContainer: UIView = {
let container = UIView(frame: .zero)
container.translatesAutoresizingMaskIntoConstraints = false
return container
}()
private lazy var bannerAd: BannerProvider = {
let banner = BannerProvider(identifier: "ad identifier")
banner.initBannerToBeIncluded(in: bannerContainer)
banner.adDelegate = self
return banner
}()
override func viewDidLoad() {
super.viewDidLoad()
...
bannerAd.loadAd(for: self)
}
}
extension SomeViewController: AdInteractable {
func adLoaded() {
print("Banner loaded!")
}
func failedToPresent(dueTo error: Error) {
print("Banner failed to init due to \(error.localizedDescription)")
}
}
pending doc
pending doc
GoogleService-Info
must be included in the main projectlink |
Stars: 1 |
Last commit: 2 weeks ago |
Full Changelog: https://github.com/GeekingwithMauri/AdsEngine/commits/0.1.0
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics