Skip to content
Snippets Groups Projects
README.md 4.79 KiB

Elixxir dApps Swift SDK

Swift 5.6 platform iOS

📱 Demo

Refer to this demo to see an example of how to build an app with the SDK to send E2E messages and send RestLike messsage.

Also you can checkout included example iOS application.

📖 Documentation

You can find full documentation with step by step guide here

🚀 Quick Start

Add ElixxirDAppsSDK library as a dependency to your project using Swift Package Manager.

▶️ Instantiating client

Create a new client and store it on disk:

let downloadNDF: NDFDownloader = .live
let createClient: ClientCreator = .live
try createClient(
  directoryURL: ...,
  ndf: try downloadNDF(.mainnet),
  password: ...
)

Load existing client from disk:

let loadClient: ClientLoader = .live
let client = try loadClient(
  directoryURL: ..., 
  password: ...
)

You can also use a convenient ClientStorage wrapper to manage a client stored on disk:

let storage: ClientStorage = .live(
  passwordStorage: .init(
    save: { password in
      // securely save provided client's password
    },
    load: {
      // load securely stored client's password
    }
  )
)
let client: Client
if storage.hasStoredClient() {
  client = try storage.loadClient()
} else {
  client = try storage.createClient()
}

Check out included example iOS application for the PasswordStorage implementation that uses the iOS keychain.

▶️ Connecting to the network

Start network follower:

let client: Client = ...
try client.networkFollower.start(timeoutMS: 10_000)