Skip to content

Instantly share code, notes, and snippets.

@ghermanowski
ghermanowski / CaptureTextFromCamera.md
Created June 9, 2022 17:32
How to Capture Text from the Camera in SwiftUI 3

How to Capture Text from the Camera in SwiftUI 3

To create a button for this purpose, you need a class that adopts the protocols UIResponder and UIKeyInput. The required variable hasText and method deleteBackward are not used so you can just ignore them.

class ScanTextResponder: UIResponder, UIKeyInput {
	init(title: Binding<String>) {
		_title = title
	}