Portal provides MPC wallets and dApp connections for exchanges and their users. To integrate Portal, an exchange adds a client library to their mobile app and a few server API endpoints.
The Portal library connects your mobile app and server with the web3 ecosystem.


Cocoa pods

We use cocoa pods for distributing our swift package.
For more information on cocoa pods, read this.


Reach out to Portal to get added to our private pod repo.

Set up

Add this to your pod file:
pod 'PortalSwift', :git => 'https://github.com/portal-hq/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.

Initializing Portal

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.
With the PortalSwift pod now installed, 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()),
chainId: 5,
keychain: PortalKeychain(),
gatewayConfig: [
5: "https://eth-goerli.g.alchemy.com/v2/[ALCHEMY_API_KEY]"
// 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!