Vision Framework

Oct 9 2025 · Swift 5, iOS 26, Xcode 26

Lesson 04: Unveiling New Vision Framework Features in iOS 18 & iOS 26

Demo 02

Episode complete

Play next episode

Next

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

There weren’t a large number of improvements to Vision in iOS 26, but there is a new API that extends on the API seen in the last demo. The RecognizeDocumentsRequest API improves on the functionality seen in RecognizeTextRequest by providing the ability to read structural elements of a page, like tables, lists, and important information like phone numbers. It also provides support in 26 languages. The new API can also provide an estimate of camera lens smudge detection, which is actually used in the Camera app in iOS 26. Let’s take a look at the new structure detection in a demo.

let textDetectionRequest = RecognizeDocumentsRequest()
 // Perform the request on the image data and return the results.
let observations = try await textDetectionRequest.perform(on: UIImage(ciImage: processedImage).pngData()!)

// Get the first observation
guard let document = observations.first?.document else {
  throw RecognitionError.documentNotAvailable
}

for paragraph in document.paragraphs {
 textRectangles.append((paragraph.boundingRegion.boundingBox.cgRect, paragraph.transcript))
 
}

var detectedEmail = ""
var detectedPhone = ""
var detectedAddress = ""

//loop through the observations
for result in observations {
	for detectedData in result.document.text.detectedData
	{
	  switch detectedData.match.details {
	  case .emailAddress(let email):
	    detectedEmail = email.emailAddress
	    print("detected email \(detectedEmail)")
	  case .phoneNumber(let phoneNumber):
	    detectedPhone = phoneNumber.phoneNumber
	    print("detected phone number \(detectedPhone)")
	  case .postalAddress(let address):
	    detectedAddress = address.fullAddress
	    print("detected address \(detectedAddress)")
	  default:
	      break
	  }
	}
}
enum RecognitionError: Error {
    case documentNotAvailable
    case noElementExists
}
See forum comments
Cinema mode Download course materials from Github
Previous: Demo Next: Conclusion