David Seek David Seek - 1 year ago 61
Swift Question

What is the print result of an object?

Printing the


override func viewDidAppear(_ animated: Bool) {

Results in
<UITableView: 0x7fe33701e000...

the memory address of the object
or is it the ID or what is it? Help is very appreciated.


override func viewDidAppear(_ animated: Bool) {
withUnsafePointer(to: &tableView) {
print("\(tableView) has address: \($0)")

Results in:

<UITableView: 0x7fcdca810600... has address: 0x00007fff594533f0

So I'm able to exclude the idea that it might be the memory address(?).

Answer Source

0x7fcdca810600 is the address of the UITableView instance pointed to by the tableView variable.

0x00007fff594533f0 is the address of the tableView variable.

Your original thought was correct.

BTW - the output of printing classes, such as UITableView is from the description method. The default is to show the object's type and memory address. You can change the output by implementing or overriding the description method.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download