iOS Integration Guide
Wallet Core is available on the iOS platform, it comes with Swift bindings. In this guide we show how to use it.
A sample application is available at: https://github.com/trustwallet/wallet-core/tree/master/samples/osx .
Prerequisites
CocoaPods. If you don't have it, install it by
gem install cocoapods
.Xcode toolchain
Wallet Core library
Adding Library Dependency
An easy way to add Wallet Core dependency to an iOS project is through CocoaPods, like this (the exact version may change in the future):
The dependency can be installed simply by pod install
:
SPM is also supported, download latest Package.swift
from GitHub Releases and put it in a local WalletCore
folder.
Add this line to the dependencies
parameter in your Package.swift
:
Or add remote url + master
branch, it points to recent (not always latest) binary release.
Then add libraries to target's dependencies
:
Code Examples
In the following sections we show code examples for some common funcions. Please refer to the Wallet Usage Guide for detailed explanations.
Accessing Wallet Core functionality requires one import statement:
Wallet Management
Creating or Importing a Multi-Coin HD Wallet
Account Address Derivation
Generating the Default Address for a Coin
Generating an Address Using a Custom Derivation Path (Expert)
Transaction Signing
In general, when creating a new blockchain transaction, a wallet has to:
Put together a transaction with relevant fields (source, target, amount, etc.)
Sign the transaction, using the account private key. This is done by Wallet Core.
Send to a node for broadcasting to the blockchain network.
Ethereum Transaction Signing
Code example to fill in signer input parameters, perform signing, and retrieve encoded result:
Last updated