1.0.8
버전부터 지원합니다.extension DaroMAdUnit {
static let lightPopup = DaroMAdUnit(
adUnitID: "...",
format: .lightPopup
)
}
라이트 팝업 광고를 로드하고 표시하기 위한 코드 예제입니다.
import Daro
final class SampleVC: UIViewController {
var lightPopupAd: DaroLightPopupAd?
func loadLightPopupAd() {
Task {
var config = DaroAdLightPopupConfiguration()
self.lightPopupAd = try await DaroLightPopupAd.load(adUnit: .lightPopup, configuration: config)
}
}
func showInterstitialAd() {
lightPopupAd?.fullScreenDelegate = self
guard lightPopupAd?.canPresent(from: self) == true else { return }
lightPopupAd?.present(fromRootViewController: self)
}
}
extension SampleVC: DaroFullScreenAdDelegate {
func didFailToPresent(with error: Error) {
print("\(#function) error: \(error.localizedDescription)")
}
func willPresentFullScreenContent() {
print("\(#function)")
}
func willDismissFullScreenContent() {
print("\(#function)")
}
func didDismissFullScreenContent() {
print("\(#function)")
}
func didRecordImpression() {
print("\(#function)")
}
func didRecordClick() {
print("\(#function)")
}
}
DaroAdLightPopupConfiguration
를 사용해서 라이트 팝업의 색상, 버튼 텍스트 등 다양한 UI 요소를 커스터마이징할 수 있습니다.
let config = DaroAdLightPopupConfiguration()
config.backgroundColor = .systemBackground // 배경색
config.cardViewBackgroundColor = .systemBackground // 광고 컨텐츠 배경색
config.adMarkLabelTextColor = .label // 광고 마크 레이블 텍스트 색상
config.adMarkLabelBackgroundColor = UIColor.secondarySystemBackground.withAlphaComponent(0.32) // 광고 마크 레이블 배경색
config.closeButtonText = "닫기" // 닫기 버튼 텍스트
config.closeButtonTextColor = .label // 닫기 버튼 텍스트 색상
config.titleTextColor = .label // 타이틀 텍스트 색상
config.bodyTextColor = .label // 본문 텍스트 색상
config.ctaTextColor = .label // CTA 텍스트 색상
config.ctaBackgroundColor = UIColor.secondarySystemBackground.withAlphaComponent(0.0) // CTA 배경색
DaroLightPopupAd.load(adUnit: .lightPopup, configuration: config)