Created
March 20, 2017 08:58
-
-
Save itsdamslife/6d79679ec2b602379d9ee306dafe80ef to your computer and use it in GitHub Desktop.
A memory utility function in Swift to return the address of a reference variable.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct MemUtil { | |
public static func address(_ o: UnsafeRawPointer) -> String { | |
let address = unsafeBitCast(o, to: Int.self) | |
return String(format: "%p", address) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment