Skip to content

Instantly share code, notes, and snippets.

View c-villain's full-sized avatar
🎸
🤟🏻

Alexander Kraev c-villain

🎸
🤟🏻
View GitHub Profile
@c-villain
c-villain / MemoryAddress.swift
Created January 10, 2023 22:16 — forked from nyg/MemoryAddress.swift
Get the memory address of both class and structure instances in Swift.
// https://stackoverflow.com/a/45777692/5536516
import Foundation
struct MemoryAddress<T>: CustomStringConvertible {
let intValue: Int
var description: String {
let length = 2 + 2 * MemoryLayout<UnsafeRawPointer>.size