> For the complete documentation index, see [llms.txt](https://aatkit.gitbook.io/ios-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aatkit.gitbook.io/ios-integration/start/setup/swift-package-manager.md).

# Swift Package Manager

Add AATKit to your app using Swift Package Manager

AATKit has two Swift Package Manager layouts. Which one you follow depends on the version you integrate.

| AATKit version                           | Layout                                                                                                      | Follow                                   |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| **3.17.2 and earlier**, and 3.18.0-beta1 | One **AATKit** package that wraps AATKit and every ad network, offered as library products of that package. | [Single package](#single-package)        |
| **3.18.0-beta2** and newer beta releases | A **core** package, one package per **ad network** and per **CMP**, and the **AATKit-Default** umbrella.    | [Split packages (beta)](#split-packages) |

{% hint style="info" %}
The split distribution is still in **beta**. Unless you are integrating a 3.18 beta release, follow [Single package](#single-package).

The split affects **Swift Package Manager** only. [CocoaPods](/ios-integration/start/setup/cocoapods.md) integration is the same in either case.
{% endhint %}

## Single package <a href="#single-package" id="single-package"></a>

A swift package manager that wraps AATKit and ad networks.

### Integration Steps <a href="#integration-steps" id="integration-steps"></a>

* Open your Xcode project, navigate the File tab within the macOS bar, and click on “Add Packages”.
* In the URL field, enter: `https://github.com/AddApptr/AATKit` and select **AATKit**.
* Set the dependency rule to **"Exact Version"** and specify the desired AATKit version (refer to the [release notes](https://aatkit.gitbook.io/release-notes) for the latest stable version).
* Click **Next** and wait for the package to finish fetching.
* When prompted to choose a target, leave it unselected and click **"Add Package"**.
* Switch to project and choose your target then general.
* Add the required AATKit dependencies under "**Frameworks, Libraries, and Embedded Content"** depending on which libraries you intend to include in your project.

#### Integrate AATKit with all default ad network SDKs:

* Choose `AATKit-Core` and `AATKit-Default` like the following:

#### Integrate AATKit with specific ad network SDKs: <a href="#integrate-aatkit-with-specific-a-d-network-sdks" id="integrate-aatkit-with-specific-a-d-network-sdks"></a>

* Select `AATKit-Core` and all ad networks you want by selecting `AATKit-<AD_NETWORK>` (Replace <`AD_NETWORK`> with the proper Ad Network) like the following:

{% hint style="info" %}
You have to add `-ObjC` to your build settings (Other Linker Flags) by following these steps:

* Click on the project navigator.
* Click on your target and build settings.
* Search for "other linker flags".
* Add `-ObjC`.
  {% endhint %}

## Split packages (beta) <a href="#split-packages" id="split-packages"></a>

{% hint style="warning" %}
This layout is available from **3.18.0-beta2** onwards. Stable releases still ship the [single package](#single-package) described above.
{% endhint %}

From **3.18.0-beta2**, AATKit's Swift Package Manager distribution is split into separate packages: one package per **ad network**, one package per **CMP**, and an **umbrella** package that brings AATKit together with all default ad networks in a single step.

{% hint style="info" %}
Already integrated with the single AATKit package (3.17.x or earlier)? Follow [Migrating to split SPM distribution](/ios-integration/start/setup/migrating-to-split-spm-distribution.md).
{% endhint %}

### Choose your integration <a href="#choose-your-integration" id="choose-your-integration"></a>

| You want                                | Add                                                        |
| --------------------------------------- | ---------------------------------------------------------- |
| AATKit with all default ad network SDKs | The umbrella package **AATKit-Default** — nothing else.    |
| AATKit with specific ad network SDKs    | One package per ad network you want, from the table below. |

### Packages <a href="#packages" id="packages"></a>

{% hint style="success" %}
**Every package on this page ships AATKit itself.** Adding one ad network package — or one CMP package — gives you AATKit together with that SDK.
{% endhint %}

#### Umbrella package

| Package            | Repository                                   | Library to link  | When to add                                                                                                                     |
| ------------------ | -------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **AATKit-Default** | <https://github.com/AddApptr/AATKit-Default> | `AATKit-Default` | When you want AATKit with all default ad networks. It pulls in AATKit itself and every default ad network package listed below. |

#### Default ad network packages

Each of these is included in **AATKit-Default**. Add a package individually only when you integrate specific ad networks instead of the umbrella.

| Package                          | Repository                                                 | Library to link                | Ad networks included                                                                                                                |
| -------------------------------- | ---------------------------------------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| **AATKit-GraviteRTB**            | <https://github.com/AddApptr/AATKit-GraviteRTB>            | `AATKit-GraviteRTB`            | GraviteRTB                                                                                                                          |
| **AATKit-GooglePartnerBidding**  | <https://github.com/AddApptr/AATKit-GooglePartnerBidding>  | `AATKit-GooglePartnerBidding`  | Google Partner Bidding                                                                                                              |
| **AATKit-GoogleMobileAds**       | <https://github.com/AddApptr/AATKit-GoogleMobileAds>       | `AATKit-GoogleMobileAds`       | Admob (Google AdMob), DFP (Google Ad Manager), and the [AdMob custom events adapter](/ios-integration/other/admob-custom-events.md) |
| **AATKit-AppLovin**              | <https://github.com/AddApptr/AATKit-AppLovin>              | `AATKit-AppLovin`              | AppLovin                                                                                                                            |
| **AATKit-AppNexus**              | <https://github.com/AddApptr/AATKit-AppNexus>              | `AATKit-AppNexus`              | AppNexus (Xandr)                                                                                                                    |
| **AATKit-InMobi**                | <https://github.com/AddApptr/AATKit-InMobi>                | `AATKit-InMobi`                | InMobi                                                                                                                              |
| **AATKit-Mintegral**             | <https://github.com/AddApptr/AATKit-Mintegral>             | `AATKit-Mintegral`             | Mintegral                                                                                                                           |
| **AATKit-PubNative**             | <https://github.com/AddApptr/AATKit-PubNative>             | `AATKit-PubNative`             | PubNative                                                                                                                           |
| **AATKit-Tappx**                 | <https://github.com/AddApptr/AATKit-Tappx>                 | `AATKit-Tappx`                 | Tappx                                                                                                                               |
| **AATKit-Unity**                 | <https://github.com/AddApptr/AATKit-Unity>                 | `AATKit-Unity`                 | Unity                                                                                                                               |
| **AATKit-Vungle**                | <https://github.com/AddApptr/AATKit-Vungle>                | `AATKit-Vungle`                | Vungle, Vungle Bidding                                                                                                              |
| **AATKit-IronSource**            | <https://github.com/AddApptr/AATKit-IronSource>            | `AATKit-IronSource`            | IronSource                                                                                                                          |
| **AATKit-Prebid**                | <https://github.com/AddApptr/AATKit-Prebid>                | `AATKit-Prebid`                | Prebid ([DFP client-side header bidding](/ios-integration/ad-networks/dfp-client-side-header-bidding.md))                           |
| **AATKit-MetaBidding**           | <https://github.com/AddApptr/AATKit-MetaBidding>           | `AATKit-MetaBidding`           | [Meta Bidding](/ios-integration/ad-networks/meta-bidding.md)                                                                        |
| **AATKit-MolocoBidding**         | <https://github.com/AddApptr/AATKit-MolocoBidding>         | `AATKit-MolocoBidding`         | Moloco Bidding                                                                                                                      |
| **AATKit-DigitalTurbineBidding** | <https://github.com/AddApptr/AATKit-DigitalTurbineBidding> | `AATKit-DigitalTurbineBidding` | Digital Turbine Bidding                                                                                                             |

#### Optional packages

These are **not** part of **AATKit-Default**. Add them individually, whether you integrate the umbrella package or specific ad networks.

| Package                   | Repository                                          | Library to link         | Included                                                                                             |
| ------------------------- | --------------------------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------- |
| **AATKit-Amazon**         | <https://github.com/AddApptr/AATKit-Amazon>         | `AATKit-Amazon`         | [AmazonHB](/ios-integration/ad-networks/amazonhb.md)                                                 |
| **AATKit-Teads**          | <https://github.com/AddApptr/AATKit-Teads>          | `AATKit-Teads`          | Teads                                                                                                |
| **AATKit-DisplayIO**      | <https://github.com/AddApptr/AATKit-DisplayIO>      | `AATKit-DisplayIO`      | [DisplayIO (Display.io)](/ios-integration/ad-networks/displayio.md)                                  |
| **AATKit-UTIQ**           | <https://github.com/AddApptr/AATKit-UTIQ>           | `AATKit-UTIQ`           | [UTIQ](/ios-integration/advanced/targeting/utiq.md)                                                  |
| **AATKit-GoogleCMP**      | <https://github.com/AddApptr/AATKit-GoogleCMP>      | `AATKit-GoogleCMP`      | [Google CMP](/ios-integration/start/consent/managed-consent/google-cmp.md) (User Messaging Platform) |
| **AATKit-SourcePointCMP** | <https://github.com/AddApptr/AATKit-SourcePointCMP> | `AATKit-SourcePointCMP` | [Sourcepoint CMP](/ios-integration/start/consent/managed-consent/sourcepoint-cmp.md)                 |
| **AATKit-AppConsentCMP**  | <https://github.com/AddApptr/AATKit-AppConsentCMP>  | `AATKit-AppConsentCMP`  | [SFBX (AppConsent) CMP](/ios-integration/start/consent/managed-consent/sfbx-appconsent-cmp.md)       |

### Integration steps for split packages <a href="#integration-steps-split" id="integration-steps-split"></a>

* Open your Xcode project, navigate to the **File** menu in the macOS bar, and click **Add Package Dependencies…**.
* In the URL field, enter the repository URL of the package you want to add, taken from the tables above.
* Set the **Dependency Rule** to **"Exact Version"** and specify the desired AATKit version (refer to the [release notes](https://aatkit.gitbook.io/release-notes) for the available beta versions).
* Click **Add Package** and wait for the package to finish fetching.
* When prompted to choose a target, add the package's library product — the value from the **Library to link** column — to your app target.
* Repeat these steps for every package you need.
* Switch to your project, choose your target, then **General**, and make sure the library products you added appear under **"Frameworks, Libraries, and Embedded Content"**.

{% hint style="warning" %}
Use the **same exact version** for every AATKit package you add. AATKit packages pin each other to an exact version, so mixing versions leads to dependency resolution conflicts.
{% endhint %}

#### Integrate AATKit with all default ad network SDKs <a href="#all-default-a-d-networks-split" id="all-default-a-d-networks-split"></a>

Add the **AATKit-Default** package only, and link the `AATKit-Default` library. It brings AATKit itself and every default ad network package with it.

#### Integrate AATKit with specific ad network SDKs <a href="#specific-a-d-networks-split" id="specific-a-d-networks-split"></a>

Add one package per ad network you want from the tables above, and link each package's library. Ad network SDKs you do not add are not part of your app.

For example, an app running Admob, Unity and Vungle adds three packages — **AATKit-GoogleMobileAds**, **AATKit-Unity** and **AATKit-Vungle** — and links `AATKit-GoogleMobileAds`, `AATKit-Unity` and `AATKit-Vungle`. AATKit itself comes in through those packages.

### Using a Package.swift manifest <a href="#using-a-package-swift-manifest" id="using-a-package-swift-manifest"></a>

If your app or one of its modules is a Swift package, declare the same packages in `Package.swift`. Replace `<AATKIT_VERSION>` with the AATKit version you want.

All default ad networks:

```swift
dependencies: [
    .package(url: "https://github.com/AddApptr/AATKit-Default.git", exact: "<AATKIT_VERSION>"),
],
targets: [
    .target(
        name: "MyApp",
        dependencies: [
            .product(name: "AATKit-Default", package: "AATKit-Default"),
        ]
    ),
]
```

Specific ad networks — here Admob, Unity and Vungle:

```swift
dependencies: [
    .package(url: "https://github.com/AddApptr/AATKit-GoogleMobileAds.git", exact: "<AATKIT_VERSION>"),
    .package(url: "https://github.com/AddApptr/AATKit-Unity.git", exact: "<AATKIT_VERSION>"),
    .package(url: "https://github.com/AddApptr/AATKit-Vungle.git", exact: "<AATKIT_VERSION>"),
],
targets: [
    .target(
        name: "MyApp",
        dependencies: [
            .product(name: "AATKit-GoogleMobileAds", package: "AATKit-GoogleMobileAds"),
            .product(name: "AATKit-Unity", package: "AATKit-Unity"),
            .product(name: "AATKit-Vungle", package: "AATKit-Vungle"),
        ]
    ),
]
```

{% hint style="info" %}
You have to add `-ObjC` to your build settings (Other Linker Flags) by following these steps:

* Click on the project navigator.
* Click on your target and build settings.
* Search for "other linker flags".
* Add `-ObjC`.
  {% endhint %}

## Configure Google Ads SDK <a href="#add-an-optional-a-d-network" id="add-an-optional-a-d-network"></a>

Please configure your Google Mobile Ads SDK as described [here](/ios-integration/ad-networks/google-mobile-ads-sdk.md).
