_images/Simba-NS.png

SIMBA CarDemo iOS

Note

HDwallets are not setup to be encrypted when stored locally. This should be addressed for any usage apart from demo purposes.

Installation

  • Hit the “Clone or Download” button in upper right corner of the github page
  • Hit the “Open in Xcode” button.
  • Hit the “Open Xcode” button on the popup.
  • Choose where you want to save the project and hit clone.
  • Xcode should open the project.

Note

If the app shows errors give it a minute and try building or running the app a few times

Using SIMBA Chain


Here is a playlist on the SIMBA Chain Youtube channel to get you up to speed on using the dashboard.

Smart Contract

Here is the smart contract I used for iOS

contract Application {
 function Application() public {}

 function carSale (
     string soldTo,
     string amount,
     string _bundleHash
 )
 public {}

 function registerCar (
     string VIN,
     string Make,
     string Model,
     string _bundleHash
 )
 public {}

 function accidentReport (
     string report_name,
     string _bundleHash
 )
 public {}
 }

Creating an app on the SIMBA Dashboard

Before Starting make sure you have an account on the Simba Dashboard and an Ethereum wallet with Ether in it on the Rinkeby testnet

  • Create The Smart Contract
  • Create The Application
  • Configure The Application(Ethereum Blockchain, Rinkeby Network,IPFS Filesystem, Permission disabled)
  • Generate API Key(This is not the API name)
_images/APIKey.png

Converting the Cardemo example to your app

  • Update URL
    • Line 10 APIs.swift in swaggers
    • Line 158 PostRegistrationViewController.swift
    • Line 209 PostRegistrationViewController.swift

    Note

    The only part of the URL you need to change is “ioscardemo2” with whatever you chose for your app’s API name(not the name of your apikey)

  • Update API Key
    • Line 13 APIs.swift in swaggers
    • Line 160 PostRegistrationViewController.swift
    • Line 207 PostRegistrationViewController.swift