# Initialize Mediation

## Import Headers

Add the following import headers to the top of any class file that will be using a Mediation and Core class:

```swift
import ChartboostCoreSDK
import ChartboostMediationSDK
```

## Network Kill Switch

The network kill switch is a static method `ChartboostMediation.setPreinitializationConfiguration()` that must be called before Core SDK initialization is initiated. This prevents specific partners from being initialized. 

```swift
// Optionally set the Chartboost Mediation preinitialization configuration
// to disable some mediation partners.
ChartboostMediation.setPreinitializationConfiguration(
    .init(skippedPartnerIDs: YOUR_LIST_OF_PARTNER_IDS_TO_SKIP)
)
```

| Partner                           | Identifier           |
| --------------------------------- | -------------------- |
| AdMob                             | admob                |
| Amazon Publisher Services         | amazon_aps           |
| AppLovin                          | applovin             |
| BidMachine                        | bidmachine           |
| Chartboost Monetization           | chartboost           |
| Digital Turbine Exchange (Fyber)  | fyber                |
| HyprMX                            | hyprmx               |
| Google Bidding                    | google_googlebidding |
| InMobi                            | inmobi               |
| ironSource                        | ironsource           |
| Liftoff Monetize (Vungle)         | vungle               |
| Meta Audience Network             | facebook             |
| Mintegral                         | mintegral            |
| MobileFuse                        | mobilefuse           |
| Pangle                            | pangle               |
| Unity                             | unity                |
| Verve                             | verve                |

## Consent Management Platform

A Consent Management Platform (CPM) is required and handled by the Core SDK. Review the Core SDK's [Consent Management Platform](/en/mediation/integrate/core/ios/integration/#consent-management-platform) documentation to set up your CPM module. Once a CPM is chosen and setup, initialize the module.

```swift
// Create a consent module instance, e.g. Usercentrics
let usercentrics = UsercentricsAdapter(
    options: .init(settingsId: "<YOUR USECENTRICS SETTINGS ID>")
)
```

## Initialize Chartboost Core

Initializing Chartboost Core only requires your Chartboost App ID which initializes Mediation. 

To find your Chartboost app ID, log into your [Chartboost platform](https://platform.chartboost.com/){:target="_blank"}, navigate to **Apps Management**, select your app, and the app ID will be listed on the right column under **App information**.

```swift
// Initialize Core.
// This automatically initializes the Chartboost Mediation SDK, as well as other
// modules included in the `modules` array.
// Make sure to include your consent module in this array.
ChartboostCore.initializeSDK(
    configuration: .init(chartboostAppID: "<YOUR APP ID>", modules: [usercentrics]),
    moduleObserver: self  // optional observer, can be nil
)
```

## ModuleObserver

The module observer notifies when the specified module finishes initialization so additional action can follow. This module is optional.

```swift
// Optionally implement the ModuleObserver protocol to get notified when some
// particular module is initialized (e.g. Chartboost Mediation).
func onModuleInitializationCompleted(_ result: ModuleInitializationResult) {
    if result.moduleID == ChartboostMediation.coreModuleID {
        if let error = result.error {
            // Handle error
        } else {
            // Success
        }
    }
}
```




