Search code examples
iosswifttvosgamecontroller

Getting hash values from object in swift


In Swift, when I'm typing

var controller : GCController
// fetch some data to conbroller
NSLog("Controller: %@",controller)

NSLog prints nice

Controller: <GCController 0x1700a7680 vendorName='Remote' deviceHash=0x414e6d3d6a8c2215>

wheres vendorName is public variable in GCController, but the deviceHash is not. Can I somehow access the value? Even as plain string? From where NSLog takes the values? I tried making NSString in similar format, but it didn't give me the expected results


Solution

  • NSLog is probably showing you the GCController's debugDescription property whereas print and the likes will show you the description property.