I have added an Objective-C category to my Swift 3.0 code. It has a method with header:
+(UIBezierPath *)interpolateCGPointsWithHermite:(NSArray *)pointsAsNSValues closed:(BOOL)closed;
When I call it from my Swift code:
antiAliasing = dict.value(forKey: "antAliasing") as! NSArray
UIBezierPath.interpolateCGPoints(withHermite: antiAliasing, closed: true)
I got the error:
Cannot convert value of type 'NSArray' to expected argument type '[Any]!'
What is the problem with that ?
antiAliasing = dict.value(forKey: "antAliasing") as? NSArray ?? [ANY]
This will clear the error but check if r getting the correct results – KoushikpointsAsNSValues
I'd tryas! [NSValue]
. And don't usevalueForKey
unless you can explain why you need KVC. – vadian