Usage Guide
  • 23 Oct 2023
  • 1 Minute to read
  • Dark
    Light
  • PDF

Usage Guide

  • Dark
    Light
  • PDF

Article summary

This section is a usage guide of the various Radix Engine Toolkit wrappers alongside example usages.

Notes

  • All of the Swift examples provided in this section depend on a utility file that contains the following code:

    import Foundation
    
    extension String {
        func hexToData() -> Data? {
            var data = Data()
            var startIndex = self.startIndex
            while startIndex < self.endIndex {
                let endIndex = self.index(startIndex, offsetBy: 2)
                if let byte = UInt8(self[startIndex..<endIndex], radix: 16) {
                    data.append(byte)
                } else {
                    return nil // Invalid hex string
                }
                startIndex = endIndex
            }
            return data
        }
    }


Was this article helpful?

What's Next