How to exploit a vision function?

Hi,
on this page:

https://developer.apple.com/documentation/vision/vnrecognizeanimalsrequest/3366120-knownanimalidentifiers

it is stated that this function: "Returns a list of animal identifiers the recognition algorithm supports for the specified revision."

How can i build a test code in playground to get that list of animals identifier?
What is the general methodology to run such functions from the documentation?
Answered by OOPer in 673253022

How can i build a test code in playground to get that list of animals identifier?

The documentation says it is a throws class-method, taking a single parameter forRevision: of type Int,
defined in the framework Vision:
Code Block
import Vision
do {
let identifiers = try VNRecognizeAnimalsRequest.knownAnimalIdentifiers(forRevision: VNRecognizeAnimalsRequest.defaultRevision)
print(identifiers) //->[__C.VNAnimalIdentifier(_rawValue: Cat), __C.VNAnimalIdentifier(_rawValue: Dog)]
} catch {
print(error)
}


What is the general methodology to run such functions from the documentation?

Better learn the basics of the Swift language.
Accepted Answer

How can i build a test code in playground to get that list of animals identifier?

The documentation says it is a throws class-method, taking a single parameter forRevision: of type Int,
defined in the framework Vision:
Code Block
import Vision
do {
let identifiers = try VNRecognizeAnimalsRequest.knownAnimalIdentifiers(forRevision: VNRecognizeAnimalsRequest.defaultRevision)
print(identifiers) //->[__C.VNAnimalIdentifier(_rawValue: Cat), __C.VNAnimalIdentifier(_rawValue: Dog)]
} catch {
print(error)
}


What is the general methodology to run such functions from the documentation?

Better learn the basics of the Swift language.
How to exploit a vision function?
 
 
Q