Skip to content

Instantly share code, notes, and snippets.

View SergLam's full-sized avatar
😊
Try to make your code better!

Serhii Liamtsev SergLam

😊
Try to make your code better!
View GitHub Profile
@SergLam
SergLam / UUID+Extensions.swift
Last active March 28, 2025 11:26 — forked from xsleonard/UUID+Extensions.swift
Swift: Convert UUID to and from Data and Int64
import Foundation
extension UUID {
// UUID is 128-bit, we need two 64-bit values to represent it
var integers: (Int64, Int64) {
var first: UInt64 = 0
first |= UInt64(uuid.0)
first |= UInt64(uuid.1) << 8
first |= UInt64(uuid.2) << (8 * 2)
first |= UInt64(uuid.3) << (8 * 3)