0
votes
var option = [NSObject : AnyObject]?.self
option = [CIDetectorSmile = true, CIDetectorEyeBlink = true, CIDetectorImageOrientation : 6]

Error: Expected ',' separator

var features = faceDetector.featuresInImage(sourceImage, options: option)

Error: Cannot invoke 'featuresInImage' with an argument list of type ('CIImage, options: [NSObject : AnyObject]?Type?)

How can I resolve that compile error?

1

1 Answers

1
votes

featuresInImage has the following signature:

func featuresInImage(_ image: CIImage, options options: [String : AnyObject]?) -> [CIFeature]

The options are of type [String : AnyObject]?. Yours is of type [NSObject : AnyObject]?.

Solution: use

var option : [String : AnyObject]? = [CIDetectorSmile : true, CIDetectorEyeBlink : true, CIDetectorImageOrientation : 6]

Since you actually supply always supply options, you can even remove the ?.

Further notes

The Expected ',' separator is caused by your usage of = and : in the dictionary value declaration, always use :!