Sample iOS Application for Wallet-Core
This folder contains a simple but complete iOS/macOS sample application, for demostrating usage of the Wallet Core library (part of Trust Wallet).
This is a sample application with demonstration purpose only, do not use it with real addresses, real transactions, or real funds. Use it at your own risk.
See the official Trust Wallet developer documentation here.
See especially Wallet Core Integration Guide, and Build Instructions.
- CocoaPods. If you don't have it, install it by
gem install cocoapods. - Xcode toolchain
Go to the samples/ios/cocoapods folder within wallet core repo:
git clone https://github.com/trustwallet/wallet-core.git
cd wallet-core/samples/ios/cocoapodsInstall dependencies with CocoaPods:
pod install- Open the following workspace with Xcode:
ios/cocoapods/WalletCoreExample.xcworkspace - Build and Run
The relevant sample code is in the file WalletCoreExample/ViewController.swift.
Output appears in Output window (or stdout).
├── Podfile
├── Podfile.lock
├── WalletCoreExample
│ ├── AppDelegate.swift
│ ├── Info.plist
│ ├── ViewController.swift
│ └── WalletCoreExample.entitlements
├── WalletCoreExample.xcodeproj
└── WalletCoreExample.xcworkspace
An overview of the operations done in the sample app is as follows.
- Import a wallet
- Create a wallet by importing an existing recovery phrase (mnemonic), using HDWallet.
- Derive address
- Address is derived from the HD wallet.
- Create send transaction
- put together a send transaction (contains sender and receiver address, amount, etc.)
- sign this transaction (using the private key)
See the Integration Guide.