Skip to main content
3Nsofts logo3Nsofts
iOS ArchitectureUpdated ·

Receipt OCR with Apple Vision: Build Reviewable Fields, Not Silent Guesses

Updated
Read time
6 min read
Level
Intermediate
Platform
Swift, iOS app development, asynchronous loading

Implementation Notes

  • ~/ What broke: A production edge case that generic tutorials skip.
  • ~/ What to do: Ship the production fix with clear state, errors, and fallback behavior.
Apple Vision receipt OCRVNRecognizeTextRequest receiptSwift OCR review fields

Receipt OCR should produce evidence a person can review. It should not silently turn a plausible string into a confirmed purchase date, warranty deadline, or total.

Apple's Vision text-recognition overview explains on-device text recognition. The application still has to decide which text belongs to which field and when that field becomes trustworthy enough to save.

1. Preserve the document before extracting fields

Assign the imported document a stable identifier. Keep its original file, orientation, and page relationship separate from OCR output. If recognition fails, the user should still be able to open the document and enter details manually.

For a multi-page document, keep each result associated with its page. “The third line” is not a durable reference if the scanner crops the page again or a later recognition pass changes reading order.

2. Configure recognition for the source

The following is a configuration fragment for the established Vision request API, not a complete scanning application:

import Vision

let request = VNRecognizeTextRequest()
request.recognitionLevel = .accurate
request.recognitionLanguages = ["en-US"]
request.usesLanguageCorrection = true

Do not hard-code English for every user's receipts. Check the languages supported by the request configuration and select those appropriate to the document. Apple's request reference documents recognition settings and supported-language queries. Run image processing outside UI-critical work and discard results for imports the person has cancelled.

Language correction may help prose while making a model number less useful. Evaluate names, serial numbers, and totals separately in a representative fixture set; one aggregate accuracy percentage can hide the field that matters most.

3. Separate three data layers

  • Recognized text. Example: 03/04/2026 in a source region. Can it drive a reminder?: No.
  • Parsed suggestion. Example: Possible purchase date with unresolved day/month order. Can it drive a reminder?: No.
  • Confirmed field. Example: A date the person reviewed with the document. Can it drive a reminder?: Only after reminder settings are confirmed.

A suggested field should carry its document ID, page, source excerpt, candidate value, and review state. Store a correction as a decision made by the person, not as a rewritten OCR result. That distinction makes later recognition updates safer.

Apple's candidate API returns alternatives in decreasing confidence order. Its confidence value describes recognition confidence. Neither identifies whether a visible amount is the subtotal, tax, or final payment.

4. Design the review screen around ambiguity

Show the proposed value beside its source excerpt and an action to open the original. If a receipt contains several amounts, label candidates by the evidence available rather than selecting the largest number automatically.

For dates such as 03/04/2026, ask the person to resolve the interpretation. For currencies, do not assign one solely from the phone's locale. Preserve the original string until the interpretation is confirmed.

Let users leave a field unknown. A blank warranty field is more honest than an invented duration. Recognizing a purchase date does not establish warranty coverage; the deadline design discussion explains that boundary.

5. Keep reprocessing from overwriting decisions

A second recognition pass should update suggestions, not confirmed values. Use a document revision and extraction revision to detect stale results. When the original is removed, mark any retained confirmed record as no longer having its source rather than leaving a working-looking link to nowhere.

Save the confirmed record and its source association together. A successful OCR pass followed by a failed save must not leave the interface claiming the item was added.

Validate behavior with difficult receipts

Include rotated pages, faint thermal print, two currencies, multiple dates, several totals, mixed languages, and a document with no receipt fields. Test cancellation during recognition, duplicate imports, save failure, and source deletion after confirmation.

Measure correction rates per field, not just recognized-character accuracy. Keep fixtures free of private customer data unless the people involved have authorized their use.

EverTrace shows the product context for connecting documents, saved details, and item history. This guide describes a review-first architecture; it does not claim a particular extraction benchmark for the app.

Authoritative References