# AdSter iOS-SDK Documentation

### Overview

The AdSter iOS-SDK provides integration for multiple ad types, including Banner, Interstitial, Rewarded, RewardedInterstitial and Native Ads. To use the SDK, you need to configure ad requests, Initialise the SDK, and conform to the necessary protocols to handle ad events such as loading, impressions, and clicks.

### Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* Use Xcode **16.0** or higher
* Target iOS **13.0** or higher

### SDK Initialisation

Before requesting any ads, you need to initialise the SDK. This is a one-time setup step that should be done at the start of your application.

#### Installation via SPM

1. In Xcode, install the AdSter SDK Swift Package by navigating to **File > Add Package Dependencies.**
2. In the prompt that appears, search for the below GitHub repository: \
   <https://github.com/adster-tech/orchestration-sdk-ios>
3. Select the version of the AdSter SDK Swift Package you want to use. For new projects, we recommend using the **Up to Next Major Version**.

#### Installation via CocoaPods

To integrate AdSter SDK into your Xcode project using CocoaPods, follow these steps:

1. Open your project's Podfile and add:

   ```ruby
   pod 'Adster', '~> 1.3.4'
   ```
2. Run the following command in the terminal:

   ```bash
   pod install
   ```
3. After installation, close Xcode and open the .xcworkspace file instead of .xcodeproj.

#### Update your Info.plist <a href="#update_your_infoplist" id="update_your_infoplist"></a>

{% hint style="info" %}
If you don't have an admob account and want to test the initialization of the SDK, please also add these to the info.plist so that the SDK initialization can be completed.
{% endhint %}

`Key -`` `<mark style="color:$success;">**`GADApplicationIdentifier`**</mark>

`Value -`<mark style="color:$success;">**`ca-app-pub-3940256099942544~3347511713`**</mark>

#### Initialising the SDK

```swift
AdSter.sharedInstance().start(completionHandler: { status in
    print("Ad initialized \(status)")
})
```

* `completionHandler`: A callback to confirm whether the initialization was successful.

### Ad Request

To request an ad, you need to initialize the `AdSterAdLoader` and configure it with the required parameters:

```swift
let loader = AdSterAdLoader()
loader.delegate = self
loader.loadAd(adRequestConfiguration: AdRequestConfiguration(
    placement: "placement_name",
    viewController: self,
    publisherProvidedId: "Test",
    customTargetingValues: ["test": "123"]
))
```

**Parameters:**

* `placement`: Unique key for the ad placement.
* `viewController`: ViewController where the ad will be presented.
* `publisherProvidedId`: Identifier for the ad unit.
* `customTargetingValues`: Optional custom targeting values to personalize the ad request.
