How can I tell which languages are available for text recognition in Apple's Vision framework?

You can easily tell Vision framework which languages are needed for text recognition using recognitionLanguages instance property:

var recognitionLanguages: [String] { get set }

According to Apple documentation:

recognitionLanguages is the order of the languages in the array defines the order in which languages are used during language processing and text recognition.

Specify the languages as ISO language codes.

So your real code may look like this:

import Vision

let recognizeTextRequest = VNRecognizeTextRequest()
recognizeTextRequest.minimumTextHeight = 0.05

recognizeTextRequest.recognitionLanguages = ["en-US", "ca-ES", "ru-RU", "fr-CA"]

P.S.

But at the moment (March 12, 2020) Vision framework supports only English. Let's wait for the next version of Vision where other languages will be supported.

enter image description here


As of iOS14, VNRecognizeTextRequestRevision2 supports English, Chinese, Portuguese, French, Italian, German and Spanish in the accurate recognition level. The fast recognition level supports English, Portuguese, French, Italian, German and Spanish.

You can check in Playground with this snippet:

try VNRecognizeTextRequest.supportedRecognitionLanguages(for: .fast, revision: 2)