iOS SDK

AeroSync iOS SDK

A native iOS SDK that provides secure bank account linking capabilities for iOS applications. Built with SwiftUI and WKWebView, this SDK allows users to securely connect their bank accounts through their bank's website with fast, secure, and tokenized connections.

šŸš€ Features

  • AerosyncSDK: Full bank linking experience with complete UI
  • AerosyncEmbeddedView: Lightweight bank search and selection interface
  • Native iOS: Built with SwiftUI and WKWebView for optimal performance
  • State Management: Maintains session state across different views
  • Secure: All communications are encrypted and tokenized
  • MFA Support: Multi-factor authentication handling
  • Deep Linking: OAuth authentication support
  • Customizable: Theming and styling options

Requirements

  • iOS 14.0+
  • Xcode 12.0+
  • Swift 5.3+

1. Create a User

The Aerosync+Aeronetwork SDKs require a user identifier, aeroPassUserUuid, to be passed to the widget on launch. Follow the guide here to create a new user and access the user's aeroPassUserUuid.

2. Installation

Swift Package Manager

Add the following to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/your-org/aerosync-ios-sdk.git", from: "2.0.4")
]

Or add it through Xcode:

  1. Open your project in Xcode
  2. Go to File → Add Package Dependencies
  3. Enter the repository URL: https://github.com/your-org/aerosync-ios-sdk.git
  4. Click Add Package

Import the SDK

import aerosync_ios_sdk

Usage Examples

1. AerosyncSDK (Full Bank Linking Experience)

The main SDK provides a complete bank linking experience:

import SwiftUI
import aerosync_ios_sdk

struct BankLinkingView: View {
    let token = "your-token-here"
    let environment = "sandbox" // dev, staging, sandbox, production
    let deeplink = "yourapp://"

    var body: some View {
        NavigationView {
            AerosyncSDK(
                token: token,
                env: environment,
                deeplink: deeplink,
                configurationId: "your-config-id", // Optional
                theme: "light", // "light" or "dark"
                handleMFA: false,
                manualLinkOnly: false,
                onSuccess: { data in
                    print("Bank linking successful: \(data)")
                    // Handle successful bank connection
                },
                onClose: { data in
                    print("Widget closed: \(data)")
                    // Handle widget closure
                },
                onEvent: { data in
                    print("Event received: \(data)")
                    // Handle various events
                },
                onError: { error in
                    print("Error occurred: \(error)")
                    // Handle errors
                },
                onLoad: { data in
                    print("Widget loaded: \(data)")
                    // Handle load completion
                }
            )
            .navigationTitle("Link Your Bank Account")
        }
    }
}

2. AerosyncEmbeddedView (Bank Search Interface)

The embedded view provides a lightweight bank search and selection interface:

import SwiftUI
import aerosync_ios_sdk

struct BankSearchView: View {
    let token = "your-token-here"
    let environment = "sandbox"
    let deeplink = "yourapp://"

    @State private var showingBankLinking = false
    @State private var stateCode: String?

    var body: some View {
        NavigationView {
            AerosyncEmbeddedView(
                token: token,
                env: environment,
                deeplink: deeplink,
                configurationId: "your-config-id", // Optional
                theme: "light", // "light" or "dark"
                onLoad: { data in
                    print("Embedded view loaded: \(data)")
                },
                onBankClick: { data in
                    print("Bank selected: \(data)")

                    // Extract stateCode from the bank selection
                    if let stateCode = data["stateCode"] as? String {
                        self.stateCode = stateCode
                        self.showingBankLinking = true
                    }
                },
                onError: { error in
                    print("Embedded view error: \(error)")
                }
            )
            .navigationTitle("Search Banks")
            .sheet(isPresented: $showingBankLinking) {
                if let stateCode = stateCode {
                    BankLinkingWithStateView(
                        token: token,
                        environment: environment,
                        deeplink: deeplink,
                        stateCode: stateCode
                    )
                }
            }
        }
    }
}

struct BankLinkingWithStateView: View {
    let token: String
    let environment: String
    let deeplink: String
    let stateCode: String

    @Environment(\.presentationMode) var presentationMode

    var body: some View {
        NavigationView {
            AerosyncSDK(
                token: token,
                env: environment,
                deeplink: deeplink,
                stateCode: stateCode, // Continue from embedded view
                onSuccess: { data in
                    print("Bank linking successful: \(data)")
                    presentationMode.wrappedValue.dismiss()
                },
                onClose: { data in
                    print("Widget closed: \(data)")
                    presentationMode.wrappedValue.dismiss()
                },
                onEvent: { data in
                    print("Event received: \(data)")
                },
                onError: { error in
                    print("Error occurred: \(error)")
                },
                onLoad: { data in
                    print("Widget loaded: \(data)")
                }
            )
            .navigationTitle("Complete Bank Linking")
            .navigationBarItems(leading: Button("Cancel") {
                presentationMode.wrappedValue.dismiss()
            })
        }
    }
}

3. MFA (Multi-Factor Authentication) Handling

For advanced use cases requiring MFA handling:

AerosyncSDK(
    token: token,
    env: environment,
    deeplink: deeplink,
    handleMFA: true,
    jobId: "your-job-id",
    connectionId: "your-connection-id",
    onSuccess: { data in
        // Handle MFA success
    },
    onClose: { data in
        // Handle closure
    },
    onEvent: { data in
        // Handle MFA events
    },
    onError: { error in
        // Handle MFA errors
    },
    onLoad: { data in
        // Handle load
    }
)

API Reference

To generate a token, check out our integration guide here.

AerosyncSDK Parameters

ParameterTypeRequiredDescription
tokenStringYesAuthentication token for the session
envStringYesEnvironment: "dev", "staging", "sandbox", "production"
deeplinkStringYesDeep link URL for your app
configurationIdString?NoConfiguration ID for customization
stateCodeString?NoState code for continuing from embedded view
handleMFABoolNoWhether to handle MFA flows (default: false)
manualLinkOnlyBoolNoWhether to show only manual linking options (default: false)
jobIdString?NoJob ID for MFA handling
connectionIdString?NoConnection ID for MFA handling
themeStringNoUI theme: "light" or "dark" (default: "light")

AerosyncEmbeddedView Parameters

ParameterTypeRequiredDescription
tokenStringYesAuthentication token for the session
envStringYesEnvironment: "dev", "staging", "sandbox", "production"
deeplinkStringYesDeep link URL for your app
configurationIdString?NoConfiguration ID for customization
themeStringNoUI theme: "light" or "dark" (default: "light")

Callback Events

AerosyncSDK Events

  • onEvent: General widget events and page navigation
  • onSuccess: Successful bank connection with account details
  • onClose: Widget closed by user
  • onLoad: Widget finished loading
  • onError: Error occurred during the process

AerosyncEmbeddedView Events

  • onLoad: Embedded view finished loading
  • onBankClick: User selected a bank (contains stateCode for widget launch)
  • onError: Error occurred in embedded view

Deep Linking Setup

The deeplink parameter is required for optimal OAuth authentication experience with major financial institutions.

1. Configure URL Scheme

Add your custom URL scheme to your app's Info.plist:

<key>CFBundleURLTypes</key>
<array>
    <dict>
        <key>CFBundleURLName</key>
        <string>com.yourapp.deeplink</string>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>yourapp</string>
        </array>
    </dict>
</array>

2. Handle Deep Links

In your SceneDelegate.swift or AppDelegate.swift:

func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    guard let url = URLContexts.first?.url else { return }
    // Handle the deep link URL
    print("Received deep link: \(url)")
}

Success Response Format

Store onSuccess() data attributes to authenticate with the Aerosync API:

{
  "type": "pageSuccess",
  "payload": {
    "user_id": "a08905dae1d74c9ea021d325d8de654f",
    "user_password": "7f9946f5e2e34f61a59f2f3c00535118",
    "ClientName": "Aeropay",
    "FILoginAcctId": 113786059
  }
}

Troubleshooting

Common Issues

  1. Widget not loading: Verify your token is valid and not expired
  2. Embedded view not responding: Check that the environment is correctly set
  3. Build errors: Ensure iOS deployment target is 14.0+
  4. Deep linking not working: Verify URL scheme configuration in Info.plist

Debug Mode

Enable debug logging by checking the Xcode console for detailed information about:

  • Widget initialization
  • State transitions
  • Error details
  • Callback events

Support

For technical support and questions, please contact our development team.

License

This SDK is proprietary software. Please refer to your license agreement for usage terms.

iOS Aerosync SDK

This iOS SDK provides an interface to load the Aerosync widget directly into your iOS app. To import it use the Swift Package Manager.

1. Installation

To install the library you need to go to your general project settings. Then to your Package Dependencies tab. Click on the "+". On the window that is opened top right search bar paste the following link to the library repo: https://github.com/Aeropay-inc/aerosync-ios-sdk.git

Set the dependency rule as Branch and the branch as main. When done click Add Package.

Go back to your general project settings and go on the Target for your project go the the General Tab. Scroll to the Frameworks, Libraries and Embedded Content to make sure the library was added there as well. If not click the "+" and find it in the directories.

Xcode sometimes takes a while to find the package and fully include it to your project so you can restart Xcode.

2. Usage/Examples

The iOS Aerosync SDK is brought into the project as a separate View through a NavigationLink. You can attach the widget to any component that will allow Navigation. In the following example a basic Text field is attached to the navigation link that will open the widget.

Swift

import Foundation  
import SwiftUI  
import aerosync_ios_sdk

struct AerosyncWidgetView : View {  
    @EnvironmentObject var appVM : AppViewModel  
    var body: some View{  
        NavigationStack{  
            NavigationLink{  
                AerosyncSDK(token: "...",  // required
                 env: "sandbox",  // required
                 deeplink: "ADD_YOUR_DEEPLINK_HERE", // required
                 consumerId: "ADD_YOUR_CONFIGURATION_ID"  
                 onEvent: self.onEvent,  
                 onSuccess: self.onSuccess,  
                 onClose: self.onClose,  
                 onLoad: self.onLoad,  
                 onError: self.onError,  
                 handleMFA: false,  
                 userId: "AEROSYNC_USER_ID",  
                 jobId: "HANDLE_MFA_JOB_ID",  
                 )
            } label: {
            VStack {
                Image(systemName: "globe")
                    .imageScale(.large)
                    .foregroundStyle(.tint)

                Text("Aerosync SDK Test")
                Button("Connect") {
                    // action to connect to Aerosync
                    print("Connect")
                }
            }
            .padding()
        }
    }
}
func onEvent(message: Any) {
    print("onEvent Callback \(message)")
}
func onSuccess(message: Any) {
    print("onSuccess Callback \(message)")
}
func onClose(message: Any) {
    print("onClose Callback \(message)")
}
func onLoad(message: Any) {
    print("onLoad Callback \(message)")
}
func onError(message: Any) {
    print("onError Callback \(message)")
}
}

The AerosyncSDK widget takes in a env parameter, a token parameter, a deeplink, and callback event notifications needed for your implementation. To generate a token, check out our integration guide here.

Each callback returns a String message that comes back from the widget based on the messages received by it.

Parameter

Type

Description

env

string

  • Required*. Available values: sandbox, production.

token

string

onEvent

function(response)

  • Required*. This method will be triggered as the user completes the bank link workflow.

onLoad

function(response)

  • Required*. Call function after the contents of webpage have been loaded as the user completes the bank link workflow.

onSuccess

function(response)

  • Required*. This method will be triggered when a bank is added successfully and the user clicks on "continue" button in the final AeroSync-UI page.

onClose

function(response)

  • Required*. This method will be triggered when the Aerosync widget is closed.

onError

function(response)

  • Required*. The method is called if AeroSync-UI dispatches any error events.

deeplink

string

  • Required* Deeplink from your app.

consumerId

string

Unique ID that represents the client to apply the customization. Contact the team for more information."

handleMFA

bool

Boolean value that determines MFA widget invocation. Contact the team for more information."

jobId

string

Unique ID that represents the current MFA jobId. Contact the team for more information." Required if handleMFA is true.

userId

string

Unique ID that represents the current MFA userId. Contact the team for more information." Required if handleMFA is true.

šŸ“˜

The deeplink parameter is a required field that links back to your iOS application for the best oAuth authentication experience.

The largest FIs in the US use oAuth experiences to authenticate their end user's banks for the optimal user experience in a secure manner.

To implement deeplinking using iOS please refer to the official iOS Deeplink guide for Universal Links here. URL Scheme method can also be used.

Store Connected Account

Store onSuccess() callback return to authenticate with the Aerosync API to retrieve account information. json { "payload": { "ClientName": "client3", "FILoginAcctId": "{"u_guid":"USR-701a457e-5b93-4598-b7a1-b968c495ee3f", "m_guid": "MBR-d699c457-90f7-4b96-96c1-c50a445eabec", "a_guid": "ACT-9f5549d6-e402-43f4-8351-cd4018de7a80"}", "user_id": "a2c7f64f-3df9-4090-b3bd-ad6fc3003c90", "user_password": "735e33b9-78ec-4887-99d7-a3056997ceb9" }, "type": "pageSuccess" }

Store onSuccess() callback return to authenticate with the Aerosync API to retrieve account information.

{
  "payload":     {  
      "ClientName": "client3",  
      "FILoginAcctId": "{\"u_guid\":\"USR-701a457e-5b93-4598-b7a1-b968c495ee3f\", \"m_guid\": \"MBR-d699c457-90f7-4b96-96c1-c50a445eabec\", \"a_guid\": \"ACT-9f5549d6-e402-43f4-8351-cd4018de7a80\"}",  
      "user_id": "a2c7f64f-3df9-4090-b3bd-ad6fc3003c90",  
      "user_password": "735e33b9-78ec-4887-99d7-a3056997ceb9" },
  "type": "pageSuccess"
}