Swift SDK
Swift SDK
Serve ads in iOS and macOS apps with Swift Package Manager.
Install
Add the Meridian Ads git repository as an SPM dependency. Pin a release tag for production builds.
Swift
// Package.swift
.package(
url: "https://git.yelle.software/yelle/saas/meridian-ads.git",
from: "0.1.0"
)
// product from sdks/swift (path in the monorepo)
// pin a git tag; this page will match sdks/swift/README.mdServe, render, click
Call serve with a placement and user key. Call recordImpression when the ad unit is on screen. Open clickURL for tracked taps.
Swift
import MeridianAds
let client = try Client(configuration: Configuration(
appKey: ProcessInfo.processInfo.environment["MERIDIAN_ADS_APP_KEY"] ?? "",
secret: ProcessInfo.processInfo.environment["MERIDIAN_ADS_SECRET"] ?? ""
))
if let decision = try await client.serve(
placement: "home",
userKey: "user-42"
) {
try await client.recordImpression(for: decision)
}