John Siu Blog

Tech - Business Tool, Personal Toys

Swift Cheatsheet

☰ Table of Content

Collection of Swift code snippets.

Int to Hex String

1
2
3
4
5
6
var ui64: UInt64 = 10
var str: String

str = String(UInt(ui64), radix: 16, uppercase: true)
str = String(format: "%016lX", ui64)
str = String(ui64, radix: 16, uppercase: true)

John Siu

Update: 2026-07-03
comments powered by Disqus