[swift-users] 'inout Data' is not convertible to 'Data'

Rick Mann rmann at latencyzero.com
Mon Apr 24 16:18:55 CDT 2017


I could swear this was compiling a couple days ago, as I was making the call inside the block and dealing with issues around that.

Can anyone explain what's going on here?

class
MyClass
{
    func
    execute()
    {
        self.dataBuffer = Data(capacity: lgsImageDataSize)
        
        self.dataBuffer?.withUnsafeMutableBytes
        ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
        error: 'inout Data' is not convertible to 'Data'

        { (inBuffer) -> Void in
            some_call(inBuffer)
            debugLog("some_call() called")
        }
    }
    
    var             dataBuffer:     Data?
}

some_call() is a C function that looks like this:

	some_result*	some_call(void* data);

The generated interface in Xcode looks like:

	public func some_call(_ data: UnsafeMutableRawPointer!) -> OpaquePointer!

I tried commenting out the call to some_call(), but I still get the error.

-- 
Rick Mann
rmann at latencyzero.com




More information about the swift-users mailing list