> For the complete documentation index, see [llms.txt](https://docs.ecommerce.seb.ee/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ecommerce.seb.ee/integration/mobile-sdk/ios-sdk/installation.md).

# Installation

Verify the SDK archive and add EGWPay to your app with Swift Package Manager,   CocoaPods, or the XCFramework.

## Prerequisites

* iOS 15.0 or later, Xcode 15 or later.
* Sandbox API credentials: a **client ID** and **client secret**, plus your **participant ID** and **shop agreement ID**. Your backend uses these; the app never sees them.
* The SDK **distribution archive** and its matching checksum file, downloaded from this documentation site.

## Verify and unpack

Verify the archive before you unpack it:

```bash
shasum -a 256 -c egw-ios-sdk-<version>.zip.sha256

unzip egw-ios-sdk-<version>.zip -d egw-ios-sdk
```

The unpacked archive contains `EGWPay.podspec` at its root and the Swift package in `egw-ios/`. Keep it somewhere stable, next to your app checkout or vendored into it, because every installation channel references it by path.

All three channels below ship identical code.

| Channel               | Use when                                                                                      |
| --------------------- | --------------------------------------------------------------------------------------------- |
| Swift Package Manager | Default. Simplest to add and update.                                                          |
| CocoaPods             | Your project already uses CocoaPods.                                                          |
| XCFramework           | You cannot use a package manager, or you want a reviewed binary with no source in your build. |

***

## Swift Package Manager

In Xcode, choose **File → Add Package Dependencies…**, click **Add Local…**, select the `egw-ios/` directory inside the unpacked archive (the one containing `Package.swift`), and add the **EGWPay** library product to your app target.

In a `Package.swift`:

```swift
dependencies: [
    .package(path: "../egw-ios-sdk/egw-ios")
],
targets: [
    .target(name: "MyApp", dependencies: [
        .product(name: "EGWPay", package: "egw-ios")
    ])
]
```

Adjust the relative path to wherever you unpacked the archive. A local `path:` dependency carries no version requirement, so Swift Package Manager builds whatever is at that path. You pin a version by choosing which archive you unpack there.

***

## CocoaPods

```ruby
platform :ios, '15.0'

target 'MyApp' do
  use_frameworks!

  pod 'EGWPay', :path => '../egw-ios-sdk'
end
```

Then run `pod install`.

* `:path` points at the **root** of the unpacked archive, not at `egw-ios/`. CocoaPods looks for a podspec at the root, and that is where `EGWPay.podspec` lives.
* `use_frameworks!` is required. EGWPay is Swift, and the legacy static-library integration cannot build Swift pods. If your project cannot use it, install the XCFramework instead.
* The podspec declares no resources and no dependencies, so there is nothing else to configure.

***

## XCFramework

Build the binary from the unpacked archive:

```bash
cd egw-ios-sdk/egw-ios
Scripts/build-xcframework.sh
# → build/EGWPay.xcframework.zip
```

The script builds device and simulator slices with `BUILD_LIBRARY_FOR_DISTRIBUTION=YES`, which is what lets the binary be used from a Swift compiler version other than the one that built it.

To add it: unzip, drag `EGWPay.xcframework` into your project, then select your app target, open **General → Frameworks, Libraries, and Embedded Content**, and set EGWPay to **Embed & Sign**.

Setting it to **Do Not Embed** compiles cleanly and then crashes at launch with `dyld: Library not loaded`. It is the most common installation mistake.

{% hint style="info" %}
Copying the `.swift` sources directly into your app is not supported. The sources would compile into your module, so your build settings and Swift version would apply to them and every internal type would become visible to your code. Use one of the three channels above.
{% endhint %}

***

## Verify the install

Add this to any file in your app and build:

```swift
import EGWPay

let probe = Configuration(apiBaseURL: nil, environment: .sandbox)
print(probe.environment == .sandbox)
```

From Objective-C:

```objc
@import EGWPay;

EGWConfiguration *probe = [[EGWConfiguration alloc] initWithApiBaseURL:nil
                                                           environment:EGWEnvironmentSandbox];
NSLog(@"%@", probe);
```

If the Objective-C form does not compile, check that your target has `CLANG_ENABLE_MODULES` set to `YES`, which is the Xcode default. `@import` requires it.

Note the naming: in Swift the types are unprefixed (`Configuration`, `PaymentKit`), and in Objective-C the same types carry an `EGW` prefix (`EGWConfiguration`, `EGWPaymentKit`).

***

## Next steps

* [Quickstart](/integration/mobile-sdk/ios-sdk/quickstart.md) - make your first sandbox payment.
* [Backend integration](/integration/mobile-sdk/ios-sdk/guides/backend-integration.md) - what your backend has to send before the app can start.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.ecommerce.seb.ee/integration/mobile-sdk/ios-sdk/installation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
