I am new coreml and I was reading a book I came across a code snippet and when I tried to run it I got the above error , I Googled but got no luck , here is my code
import UIKit
import Vision
extension UIImage {
func detectFaces(completion:@escaping ([VNFaceObservation]?)->()){
guard let image = self.cgImage else {
completion(nil)
return
}
let request = VNDetectFaceRectanglesRequest()
DispatchQueue.global().async {
let handler = VNImageRequestHandler(cgImage: image, orientation: self.cgImageOrientation)
//above error here I think cgImageOrientation is no longer available but what's the solution anyways
}
}
}
here I am using swiftUI and lifecycle methods are also selected as swiftui
,
The book name is "Practical Artificial intelligence with swift" by orielly