bakalolo bakalolo - 3 months ago 39
iOS Question

CGDataProviderCreateWithCFData function not recognized in Xcode IOS

I am looking at a camera tutorial for IOS and the

function was used. However Xcode doesn't seem to recognize it. Was this function removed from the latest Xcode Swift update? I am using Xcode version 8.1 and Swift 3. Also I have the following imports:

import UIKit
import AVFoundation


Have you tried searching "CGDataProviderCreateWithCFData" in the Apple's API reference page?

When I tried, I was guided to the Objective-C page, and its Swift link shows:



Creates a data provider that reads from a CFData object.

In Swift 3, CGDataProviderCreateWithCFData is imported as an initializer of CGDataProvider and use it as:

let dataProvider = CGDataProvider(data: imageData as CFData)

(Assuming imageData as a Data.)

You can use it with import UIKit.