Native iOS

Portal provides MPC wallets and dApp connections for organizations and their users. To integrate Portal, an organization adds a client library to their mobile app and a few server API endpoints.


We support Cocoa Pods and Swift Package Manager as distribution methods for our swift package.


Add this to your pod file:


pod 'PortalSwift', :git => ''


Run pod install.

If you are running an xcode project and need to run pod init and run into ruby or xcode errors, ensure your xcode project is compatible with an xcode version lower than 14.

After you run pod install you should see a PROJECT_NAME.xcworkspace file. Open that file with xcode. You will need to work within that file to properly have the pod linked.

Initializing Portal

We can now create an instance of the Portal class. Below is an example of how you can do this:

import PortalSwift

class ViewController: UIViewController {
  public var portal: Portal?
  public var clientApiKey: String = "CLIENT_API_KEY"

  override func viewDidLoad() {
    self.registerPortal(apiKey: self.clientApiKey)

  func registerPortal(apiKey: String) -> Void {
    do {
      // Create a Portal instance.
      portal = try Portal(
        apiKey: self.clientApiKey, // Request a Client Api Key from Portal's Rest API.
        backup: BackupOptions(icloud: ICloudStorage(), passwordStorage: PasswordStorage(), gdrive: GDriveStorage(clientID: GDRIVE_CLIENT_ID, viewController: self)),
        chainId: 5,
        keychain: PortalKeychain(),
        gatewayConfig: [
          5: "[ALCHEMY_API_KEY]"
        version: "v1",
        // Optional
        autoApprove: true
      // โœ… You successfully created a Portal instance! ๐Ÿ™Œ
      print("Client API Key: ", portal?.apiKey)

    } catch ProviderInvalidArgumentError.invalidGatewayUrl {
      // โŒ Handle Invalid Gateway URL errors.
    } catch PortalArgumentError.noGatewayConfigForChain(let chainId) {
      // โŒ Handle when the gateway config does not match the chainId you specified.
    } catch {
      // โŒ Handle errors creating an instance of Portal.

Now that we have our Portal instance, the next step is to generate a wallet. Let's create one!

Last updated