import Cocoa func address(of object: UnsafeRawPointer) -> String { let addr = Int(bitPattern: object) return String(format: "%p", addr) } struct Foo { public var baz: String } struct Bar { public private(set) var baz: String mutating func updateBaz(with text: String) { baz = text } } var foo = Foo(baz: "yankee") print("Foo holds \(foo.baz)", address(of: &foo)) foo.baz = "doodle" print("Foo holds \(foo.baz)", address(of: &foo)) var bar = Bar(baz: "sporty") print("Bar holds \(bar.baz)", address(of: &bar)) bar.updateBaz(with: "spice") print("Bar holds \(bar.baz)", address(of: &bar))