Is there anyway to simulate the [NSString stringWithFormat:@"%p", myVar]
, from Objective-C, in the new Swift language?
For example:
let str = "A String"
println(" str value \(str) has address: ?")
Note: This is for reference types.
print(Unmanaged.passUnretained(someVar).toOpaque())
Prints the memory address of someVar. (thanks to @Ying)
print(Unmanaged<AnyObject>.passUnretained(someVar as AnyObject).toOpaque())
Prints the memory address of someVar.