First steps - iOS

Initialize the DEUNA iOS SDK in your application.

The DEUNA SDK is compatible with projects using UIKit or Swift UI.

📘

Stable version: 2.9.8

Requirements

Review the requirements for using the SDK.

To use the DEUNA iOS SDK, you must have:

  • Knowledge of iOS development with Swift or Objective-C.
  • An active DEUNA account.
  • Valid DEUNA credentials.
  • Minimum configuration required for your iOS project:
    • Support for Swift 5.8.
    • Xcode version 16.0+.

📘

If you experience any delays in obtaining your credentials, then contact [email protected].

1. Install the SDK

There are two ways to install the iOS SDK:

  • Swift Package Manager (recommended)
  • Cocoapods

🚧

Follow security and privacy practices when handling user financial information.

Swift Package Manager installation

Use Swift Package Manager and install the SDK..

Cocoapods instalation

Install the DEUNA SDK with Cocoapods if your iOS project doesn't support Swift Package Management.

  1. Write native modules for React Native or Platform Channels for Flutter.
  2. In your Podfile file, add the DeunaSDK dependency.

Example

# Specify the minimum iOS deployment target
platform :ios, '12.0' 

target 'DeunaSdkDemo' do
  use_frameworks! # Enable dynamic frameworks

  pod 'DeunaSDK', '~> 2.9.8' # Add DeunaSDK dependency
end
  1. Disable ENABLE_USER_SCRIPT_SANDBOXING in Xcode.
  2. Go to Build Settings and search for User Script Sandboxing.
  3. Set the User Script Sandboxing value to No.

2. Add the SDK

Add the SDK to your project:

  1. Go to Xcode.
  2. Go to File and choose Add Package Dependencies.
  3. In the modal window, enter the repository URL and add the package to your project.
https://github.com/deuna-developers/deuna-sdk-ios

You have now added the DEUNA SDK to your project.

We recommend testing SDK features in a development environment to validate their correct operation before releasing your application.

3. Initialize the SDK

To use the SDK, you have two options:

  • Initialize the SDK.
  • Create an instance with the DeunaSDK class.
import DeunaSDK

Initialization

// Initialize the SKD through a singleton creatiom
DeunaSDK.initialize(
    environment: .sandbox, // Testing (.sandbox) or production (.production) environment
    publicApiKey: "YOUR_PUBLIC_API_KEY" // Public key proportioned by DEUNA
)

// Use the SDK through a  DeunaSDK-class shared instance
DeunaSDK.shared

Instance creation

let deunaSDK = DeunaSDK(
   environment: .sandbox, // Test (.sandbox) or production (.production) environments
   publicApiKey: "YOUR_PUBLIC_API_KEY" // DEUNA public key
)
// SDK use
deunaSDK.initPaymentWidget(...)

DeunaSDK.initialize(
    environment: .sandbox, // Test (.sandbox) or production (.production) environments
    publicApiKey: "YOUR_PUBLIC_API_KEY", // DEUNA public key
    useMainThread: true // Required for Expo apps
)
let deunaSDK = DeunaSDK(
   environment: .sandbox, // Testing (.sandbox) or production (.production) environment
   publicApiKey: "YOUR_PUBLIC_API_KEY", // DEUNA public key
   useMainThread: true // Required for Expo apps
)

4. Choose the integration component

Mobile SDKs support the following components:

📘

The iOS SDK uses the ViewController parent (topViewController orrootViewController) from your app to show a modal with the respective widget.