<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px;">
<div style="font-family: Calibri, sans-serif;">Hi,</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div style="font-family: Calibri, sans-serif;">In various contexts we see objects we know to be Swift, but we only have them as Objective-C object pointers.</div>
<div style="font-family: Calibri, sans-serif;">For example, in the debugger it is possible to be stopped in Objective-C code, have a local variable of type id or NSViewController*, but the underlying object is a custom view controller implemented in Swift.</div>
<div style="font-family: Calibri, sans-serif;">
<div style="font-family: -webkit-standard;">Also, users of the Memory Graph Debugger in Xcode, and people looking at logs or output from <font face="Consolas">po</font> of Objective-C objects (such as entries in AppKit responder chains) would benefit from this
feature.</div>
<div><br>
</div>
</div>
<div style="font-family: Calibri, sans-serif;">It is possible to inspect the Objective-C view of this type but that does not show all the Swift instance variables, and many methods (such as generic methods) can’t be called at all.</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div style="font-family: Calibri, sans-serif;">One way to solve this would be to provide a Swift standard library API of the form:</div>
<div style="font-family: Calibri, sans-serif;"><br>
</div>
<div><font face="Consolas">func buildObject<T>(fromRawPointer: UInt64) : T</font></div>
<div><span style="font-family: Calibri, sans-serif;"><br>
</span></div>
<div>I’d like to get this feature considered for the standard library, potentially with some restrictions:</div>
<ul>
<li>Since it allows people to violate ARC by storing pointer references to objects, this API might best be restricted to debugger use cases</li><li>It might be necessary to restrict T to only be of class type; it might be more difficult to refer to an Int (for example) on the stack</li></ul>
<div>Regards,</div>
<div>Deepak Singh.</div>
</body>
</html>