How do I convert my swift class to an UnsafePointer like the __bridge in objective-c
<p>I'm trying to implement a swift bridge to the <a href="https://developer.apple.com/library/mac/documentation/Security/Reference/secureTransportRef/" rel="nofollow">SecureTransport</a> C libraries. I 'think' I can pass in anything as the connection as long as I know how to read stuff from it in my sslReadCallback/sslWriteCallback implementations. This is the assumption I'm working with. This seems to be the case when I view the definition of SSLConnectionRef:</p>

<pre><code>/* Opaque reference to an I/O connection (socket, endpoint, etc.) */
public typealias SSLConnectionRef = UnsafePointer&lt;Void&gt;
</code></pre>

<p>So I just need to turn my class into UnsafePointer. Unfortunately the compiler doesn't like my attempts. Can any one give me tips?</p>

<pre><code>func startSSLProcess()
{
    self.sslContext = SSLCreateContext(kCFAllocatorDefault, SSLProtocolSide.ClientSide, SSLConnectionType.StreamType)
    if let sslContext = self.sslContext
    {
        SSLSetIOFuncs(sslContext, sslReadCallback, sslWriteCallback)
        SSLSetConnection(sslContext, UnsafePointer(self)) // &lt;-- error
        SSLSetSessionOption(sslContext, SSLSessionOption.BreakOnClientAuth, true)
        SSLHandshake(sslContext)
    }
}
</code></pre>

<p>In GCDAsyncSocket, it does this: </p>

<pre><code>status = SSLSetConnection(sslContext, (__bridge SSLConnectionRef)self);
</code></pre>

<p>and</p>

<pre><code>SubZeroGCDAsyncSocket *asyncSocket = (__bridge SubZeroGCDAsyncSocket *)connection;
</code></pre>

<p>.. to unwrap. Whats the swift equivalent of this?</p>

<p>Thanks very much!</p>