Some modifications are needed to build the application from this repo. This document explains all the steps needed to build and run the application in a simulator.
-
Clone this repo: Clone or download this repo to your computer.
-
Obtain network access: The apps need access to instances of Algod and Indexer to run. The official app supports MainNet and TestNet; however, any network can be used if you supply your node. For a private network, the quickest way to get started is using the Algorand sandbox. This page from the Algorand developer docs contains more options. Regardless of how you obtain access to instances of Algod and Indexer, you will need their addresses and API keys to continue.
-
Create a Firebase project: Since both applications use Firebase, you will need to create your own Firebase project for them to run. See the Firebase docs for further instructions.
After these steps are complete, you can move on to specific steps for iOS.
Note: These steps must be run on a MacOS machine.
- Install dependencies: First, install Cocoapods if you do not already have it. See https://guides.cocoapods.org/using/getting-started.html
for more information. Once you have Cocoapods installed, navigate to the
ios
folder and run the following command to install build dependencies:
pod install
-
Open in Xcode: you may now open the
ios/algorand.xcworkspace
files in Xcode. -
Download the iOS Firebase config file: The Firebase config file for iOS is called
GoogleService-Info.plist
. See this link for how to obtain the config file: https://support.google.com/firebase/answer/7015592. Once you've downloaded it, place it in the locationios/Support/GoogleService-Info.plist
. -
Specify network access tokens: To specify the Algod and Indexer settings; create the file
ios/Support/Config.xcconfig
. This file needs to define two values,ALGOD_TOKEN
andINDEXER_TOKEN
, which are the API tokens for Algod and Indexer respectively. For example, this is how to create a config file from the command line where the Algod token isaaa
and the Indexer token isbbb
:
echo "ALGOD_TOKEN = aaa\nINDEXER_TOKEN = bbb" > ios/Support/Config.xcconfig
- Specify network addresses: You will need to change the default addresses for Algod and Indexer
in the file
ios/Classes/Core/Environment/Environment.swift
. The variables to change aretestNetAlgodApi
,testNetIndexerApi
,mainNetAlgodApi
, andmainNetIndexerApi
. For example, if your Algod address ishttp://localhost:4001
and your Indexer address ishttp://localhost:8980
, the following changes need to be made for the MainNet variables (the TestNet variables can be similarly changed):
- lazy var mainNetAlgodHost = "node-mainnet.aws.algodev.network"
- lazy var mainNetIndexerHost = "indexer-mainnet.aws.algodev.network"
- lazy var mainNetAlgodApi = "\(schema)://\(mainNetAlgodHost)"
- lazy var mainNetIndexerApi = "\(schema)://\(mainNetIndexerHost)"
+ lazy var mainNetAlgodHost = "localhost:4001"
+ lazy var mainNetIndexerHost = "localhost:8980"
+ lazy var mainNetAlgodApi = "http://\(mainNetAlgodHost)"
+ lazy var mainNetIndexerApi = "http://\(mainNetIndexerHost)"
Note: it's ok to use a localhost address in the simulator, but that address will not work if you deploy to an actual device.
- Build the app: Once all the above steps are complete, you are ready to build and deploy the iOS app in Xcode.
Note: it's ok to use a localhost address in the simulator, but that address will not work if you deploy to an actual device.
- Build the app: Once all the above steps are complete, you are ready to build and deploy the iOS app.