Last active
December 6, 2020 13:32
-
-
Save Zlobrynya/4a7f75c44280608a74acdda82830a8b0 to your computer and use it in GitHub Desktop.
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
func address(o: UnsafeRawPointer) -> Int { | |
return Int(bitPattern: o) | |
} | |
struct myStruct { | |
var a: String | |
} | |
class myClas {} | |
//struct | |
var struct1 = myStruct(a: "5") | |
var struct2 = struct1 | |
print("struct1 \(NSString(format: "%p", address(o: &struct1)))") | |
print("struct2 \(NSString(format: "%p", address(o: &struct2)))") | |
//Class | |
var class1 = myClas() | |
var class2 = class1 | |
print("class1 \(Unmanaged.passUnretained(class1).toOpaque())") | |
print("class2 \(Unmanaged.passUnretained(class2).toOpaque())") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment