A. Glez
A. Glez

Reputation: 33

Swift3 - Ambiguous use of Init

I converted my project to Swift 3. My code was fine and after conversion I have this:

fileprivate func createImage() -> UIImage {
    return ImageProcessor.imageFromARGB32Bitmap(Data(bytes: UnsafePointer<UInt8>(&pixelBuffer), count: pixelBuffer.count), width: framebufferwidth, height: framebufferheight)
}

The error:

Ambiguous use of Init

How to fix it?

Upvotes: 2

Views: 3247

Answers (1)

OOPer
OOPer

Reputation: 47896

Try this:

    return ImageProcessor.imageFromARGB32Bitmap(Data(bytes: pixelBuffer), width: framebufferwidth, height: framebufferheight)

(Assuming ImageProcessor.imageFromARGB32Bitmap takes Data as its first parameter.)

You have no need to get an UnsafePointer from an Array of UInt8.

Upvotes: 1

Related Questions