Swiftpack.co -  computerbluemonday/AlgorandKit as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A Swift library to enable lightweight interaction with the Algorand blockchain.
.package(url: "https://github.com/computerbluemonday/AlgorandKit.git", from: "1.1.0")


A Swift library to enable lightweight interaction with the Algorand blockchain.

Embed this library to easily create and share Algorand Payment Prompt URIs and stylized QR codes.

Swift 5 Swift Package Manager MIT license

Algorand Screenshot


  • Xcode 12.0 or higher.
  • iOS 13.0 or higher.


The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

To integrate AlgorandKit into your Xcode project using Xcode 12, specify it in File > Swift Packages > Add Package Dependency...:


Or, manually add the dependency to your Package.swift:

.package(url: https://github.com/computerbluemonday/AlgorandKit, from: "1.1.0")


A utility for constructing Algorand Payment Prompt URIs, as defined by the specification:


Per the spec, this URI represents "a standardized way for applications and websites to send requests and information through deeplinks, QR codes, etc." On iOS, these URIs can be handled by the official Algorand Wallet app to delegate transaction processing on Algorand:


AlgorandURI is an immutable Swift struct which enforces business logic rules through its interface definition upon initialization. All URIs constructed via AlgorandURI should be semantically valid. (AlgorandURI does not validate addresses or transaction validity.)

The object definition lends itself to quick visual inspection in the debugger -- for instance:

▿ AlgorandURI
  - uriScheme : "algorand"
  ▿ receiver : Receiver
    ▿ label : Optional<String>
      - some : "Bob"
  ▿ assetAmount : AssetAmount
    ▿ algo : 1 element
      - microAlgos : 50
  ▿ note : Optional<note>
    ▿ some : note
      ▿ readonly : 1 element
        - xnote : "Transfer"

A suite of test cases is included for regression verification.

Usage Examples

let algoURI = AlgorandURI(
      receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Barclay"),
      assetAmount: .algo(microAlgos: 100),
      note: .readonly(xnote: "Transporter Insurance"))
let asaURI = AlgorandURI(
      receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Lanel"),
      assetAmount: .ASA(assetID: 1000000, amount: 150),
      note: .readonly(xnote: "Spaceship"))

if let url = algoURI.url() {
  if UIApplication.shared.canOpenURL(url) {
    UIApplication.shared.open(url, options: [:], completionHandler: nil)


Utilities for generating raw and stylized Algorand QR codes from AlgorandURI instances:

  • AlgorandURI (extension) -- Generate a raw QR code UIImage from an AlgorandURI
  • AlgorandQRCodeBadge -- Create a scalable, (optionally) stylized and branded Algorand QR code badge in SwiftUI

Although not explicitly provided as part of this library, see AlgorandQRCodeTests for examples of detecting Algorand QR Codes using Apple's Vision framework.

Usage Examples

// Create an AlgorandURI to receiver Barclay for 100 microAlgos, with the readonly note "Transporter Insurance"
let algoURI = AlgorandURI(
  receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Barclay"),
  assetAmount: .algo(microAlgos: 100),
  note: .readonly(xnote: "Transporter Insurance"))

// Generate a raw QR code UIImage for this transaction URI
let qrCodeImage = algoURI.generateQRCode()

// Instantiate a stylized SwiftUI QR code badge
  uri:AlgorandURI(receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: nil), assetAmount: nil, note: nil),
  qrCodeColor: UIColor.systemTeal,
  frameConfiguration: .framed(color: UIColor.darkGray),
  includeLogo: true)

Sample Screenshots

Sample Algorand QR Code 1 Sample Algorand QR Code 2 Sample Algorand QR Code 3

UIActivityViewController / AirDrop

Support for sharing AlgorandURIs with other devices or services via UIActivityViewController. Defaults to a set of sharing destinations including AirDrop, SMS, Mail, Copy/Paste; configurable to other sharing destinations by the caller.

Usage Examples

// Create an AlgorandURI to receiver Data for 400 microAlgos.
let algoURI = AlgorandURI(
  receiver: AlgorandURI.Receiver(address: "4AOJ5QITUBWZGO4K5AF77H5GED5A4QDBB6DOQGI63QE2GU6KD2XNETBBJE", label: "Data"),
  assetAmount: .algo(microAlgos: 400),
  note: .readonly(xnote: "Cat food."))

// Present UIActivityViewController to share AlgorandURI via AirDrop, SMS, etc. (SwiftUI)
if let av = algoURI.activityViewController(excludedActivityTypes: nil) {
  UIApplication.shared.windows.first?.rootViewController?.present(av, animated: true, completion: nil)

Sample Screenshots

Sample AlgorandURI AirDrop Sample AlgorandURI AirDrop Destinations Sample Receive AirDrop


AlgoSampleApp is a standalone iOS Application project which demonstrates importing AlgorandKit, and specifically demos AlgorandURI's UIActivityViewController / AirDrop support. This can also serve as a test harness for exploring other AlgorandKit functionality.

To build, simply open AlgoSampleApp.xcodeproj included in the AlgoSampleApp directory.

In Summary

Hopefully you are inspired to build interesting applications on Algorand! If you enjoy using this free library, you may choose to help test it by sending a tip (in Algos, of course!) to:




Stars: 4
Last commit: 4 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Add AirDrop and UIActivityViewController support
4 days ago
  • Add AlgorandURI support for UIActivityViewController to enable AirDrop, Copy, SMS, etc.
  • Add AlgoSampleApp as a test harness demo.
  • Fill in assets at various resolutions to fill out @2x, @3x displays, etc.
  • Refine logo and mask image sets.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API