RORK LABJP
BUILD — Rork Max runs real Macs in the cloud loaded with Xcode and the iOS SDK, writing SwiftUI, compiling, reading the errors and building again. That loop, not the code generation, is what lifts the outputNATIVE — What comes out is pure Swift and SwiftUI, not React Native. Reaching AR, Metal graphics and widgets that React Native cannot touch is the real gap between this and other buildersPLATFORMS — Coverage spans iPhone, iPad, Apple Watch, Apple TV and Vision Pro, plus iMessage. Worth a look if you want to start from a watch app or an extension rather than a phone screenCOMPANION — The Rork Companion app lets you check a generated build on a real iPhone without a paid Apple Developer account, lowering the bar for trying a first project end to endPRICING — Free to start, paid plans from $25 a month, and Rork Max on the $200 Max plan. Worth working out up front how many projects it takes to earn that backDEADLINE — From August 31, 2026, Google Play requires target API level 36 or higher for new apps and updates alike. Ten days out, and the targetSdkVersion of what you generate is yours to verifyBUILD — Rork Max runs real Macs in the cloud loaded with Xcode and the iOS SDK, writing SwiftUI, compiling, reading the errors and building again. That loop, not the code generation, is what lifts the outputNATIVE — What comes out is pure Swift and SwiftUI, not React Native. Reaching AR, Metal graphics and widgets that React Native cannot touch is the real gap between this and other buildersPLATFORMS — Coverage spans iPhone, iPad, Apple Watch, Apple TV and Vision Pro, plus iMessage. Worth a look if you want to start from a watch app or an extension rather than a phone screenCOMPANION — The Rork Companion app lets you check a generated build on a real iPhone without a paid Apple Developer account, lowering the bar for trying a first project end to endPRICING — Free to start, paid plans from $25 a month, and Rork Max on the $200 Max plan. Worth working out up front how many projects it takes to earn that backDEADLINE — From August 31, 2026, Google Play requires target API level 36 or higher for new apps and updates alike. Ten days out, and the targetSdkVersion of what you generate is yours to verify
Articles/App Dev
App Dev/2026-06-28Advanced

Building a Live Barcode and Text Scanner in Rork Max with VisionKit's DataScanner

Add a live barcode and text scanner to your Rork Max native Swift app using VisionKit's DataScanner. Covers the SwiftUI bridge, availability handling, throttling repeated detections, and on-device verification with working code.

Rork Max233VisionKitSwiftUI64DataScanneriOS110App Development33

Premium Article

When I asked Rork Max to extend a generated native Swift screen with "let me scan a product barcode," the browser live simulator showed an empty frame and the camera never opened. After some digging the answer was simple: VisionKit's DataScannerViewController does not run in the simulator at all. It only starts on a supported physical device. Rork has been smoothing out real-device testing through its Companion app and cloud Mac compilation in 2026, and camera-dependent features like this are exactly the kind you should plan to verify on hardware from the very start.

This walkthrough adds a screen that recognizes barcodes and text live, at the same time, to your Rork Max native Swift code — including the SwiftUI bridge and on-device verification. As an indie developer who has shipped apps to the App Store since 2014, I have learned that camera features trip you up most often on two fronts: permissions and device differences. I will call those out as we go.

Why pick DataScanner over hand-rolled AVFoundation

There are two common ways to read codes from the camera on iOS. The classic route is wiring up AVCaptureSession yourself and pulling barcodes from AVCaptureMetadataOutput. The other is VisionKit's DataScannerViewController, introduced in iOS 16, which bundles the camera preview, subject highlighting, pinch-to-zoom, and guidance UI together.

AspectHand-rolled AVFoundationVisionKit DataScanner
Preview renderingPlace AVCaptureVideoPreviewLayer yourselfBuilt in
Text recognitionCombine with Vision separatelySame API as barcodes, captured together
HighlightingDraw rectangles manuallyStandard via isHighlightingEnabled
Device supportWorks broadly with any cameraA12 Bionic and later (Neural Engine) only
SimulatorSometimes works, limitedUnsupported (real device required)

For cases where you want to read a product code and a model-number string together, DataScanner is dramatically shorter to write. The trade-off is the limited device support and the simulator gap, both of which you need to design around from the beginning. Before I write a line of scanner code, I decide what to show when scanning is not available.

Step 1: Declare the permission and request camera access

First, add NSCameraUsageDescription to Info.plist. You can edit it from the Rork Max project settings too. A specific, purpose-driven string removes one common App Store review rejection reason.

<key>NSCameraUsageDescription</key>
<string>Used to scan product barcodes and model numbers with the camera.</string>

Request access explicitly before showing the screen. DataScannerViewController.isAvailable returns false when the camera is not authorized, so if you check availability without first prompting, you will misclassify a perfectly capable device as "unsupported." That was my first stumble.

import AVFoundation
 
func requestCameraAccess() async -> Bool {
    switch AVCaptureDevice.authorizationStatus(for: .video) {
    case .authorized:
        return true
    case .notDetermined:
        // The dialog appears here on first run. Call this BEFORE checking availability.
        return await AVCaptureDevice.requestAccess(for: .video)
    case .denied, .restricted:
        return false
    @unknown default:
        return false
    }
}

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Turn a scanner feature that silently failed in the simulator into one that reliably runs on real devices, with a proper availability gate
Get a UIViewControllerRepresentable wrapper that bridges DataScannerViewController into SwiftUI, plus a 1.5-second throttle that stops the same code from firing over and over
Assemble a screen that recognizes barcodes and text at the same time, from the permission prompt to the result display
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

App Dev2026-07-01
Building SharePlay in Rork Max's Native Swift — Keeping Two Screens in the Same State
Implementation notes on building SharePlay with GroupActivities in Rork Max's native Swift — moving two screens through the same state over FaceTime. Covers declaring the GroupActivity, joining a GroupSession, syncing state with GroupSessionMessenger, handling latency and conflicts, catching up late joiners, and the boundary for bridging from React Native, with the pitfalls I actually hit.
App Dev2026-07-01
Building a Song-Recognition App with ShazamKit in Rork Max's Native Swift
Implementation notes on building a song-recognition app with SHManagedSession in Rork Max's native Swift. Covers the difference from hand-rolling AVAudioEngine, designing the idle / prerecording / matching states, using prerecording to improve initial accuracy, and the boundary design for bridging from Expo — with the pitfalls I actually hit.
App Dev2026-07-03
Making Your Rork Max App Resilient to Dropped and Restored Connections: Offline Detection and Retry with NWPathMonitor
Build networking that survives a lost signal in your Rork Max native Swift app with NWPathMonitor. Detect offline states, respect Low Data Mode and cellular, and auto-resend queued work on reconnect — all with working Swift code.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →