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.

The Portal library connects your mobile app and server with the web3 ecosystem.
We support Cocoa Pods and Swift Package Manager as distribution methods for our swift package.
Reach out to Portal to get added to our private Cocoa Pod or SPM repos.
Cocoa Pods
Swift Package Manager
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. 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.You must have access to our private repo:
PortalSwiftSpm
Ensure you are signed in to your Github account within Xcode
Add the
PortalSwiftSpm
package through Xcode:- 1.Click
Add package
after right-clicking on your project - 2.Search for
PortalSwiftSpm
- 3.Input the desired version and add the package.
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() {
super.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]"
],
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 modified 1d ago