Live Text

RSS for tag

Enable text interactions, translation, data detection, and QR code scanning within any image view on iOS, iPadOS, or macOS.

Posts under Live Text tag

48 Posts

Post

Replies

Boosts

Views

Activity

Enable Live Text on PDFKit
Hi! I watched WWDC2022's 10089 session "What's New in PDFKit?" where it's said that Live Text is now compatible with PDFKit. However, I can't seem to find anything related to it in documentation or code. ImageAnalyzer needs an UIImage to work. But that would mean retrieve the current PDFPage and then convert it to UIImage which is a performance hog. How can I enable Live Text in PDFKit? thanks.
1
0
1.7k
Aug ’22
How to get auto-suggested word based on drawn Chinese character or stroke info in the form of an array of CGPoint?
I have an array consists of the CGPoint representing the chinese character stroke paths and able to re-draw out the character on UIView. I would like to use this existing information to find out the most similar chinese word. I notice the chinese keyboard hand-writing pad can display the suggested words. However, I have no idea which functions in the documentation that get this to work ( pass the stroke info as CGPoint, and get back suggested Chinese words). What API calls can I use to get the suggested words?
0
0
1.7k
Aug ’22
ImageAnalysisInteraction doesn't call contentsRect delegate's method
Hello, I am struggling with an issue that contentsRect(for:) method of ImageAnalysisInteractionDelegate is not being called at any moment. I've set up the demo project where the interaction is added to root view of view controller while I'm analyzing the image of UIImageView that is added to this view. I want to achieve the behavior where I could define contents rect for highlights of found text on that image. P.S. I know that I could simply add an interaction to an image view but that's not the case - the real work that I want to achieve in the real project is to display live text on paused video player, so that image view here is for simplicity only. import UIKit import VisionKit class ViewController: UIViewController {       private let imageView = UIImageView()       private let imageAnalyzer = ImageAnalyzer()   private let interaction = ImageAnalysisInteraction()   override func viewDidLoad() {     super.viewDidLoad()           view.addSubview(imageView)     imageView.translatesAutoresizingMaskIntoConstraints = false           NSLayoutConstraint.activate([       imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor),       imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor),       imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor),       imageView.heightAnchor.constraint(equalTo: view.heightAnchor, multiplier: 0.7)     ])           interaction.delegate = self       // Some image with text that I have in assets     imageView.image = UIImage(named: "IMG_5564")     imageView.contentMode = .scaleAspectFit           view.addInteraction(interaction)           interaction.setContentsRectNeedsUpdate()           DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {       self.analyze()     }   }       private func analyze() {     Task {       let imageAnalysis = try? await imageAnalyzer.analyze(         self.imageView.image!,         configuration: .init([.machineReadableCode, .text])       )               self.interaction.analysis = imageAnalysis       self.interaction.preferredInteractionTypes = .automatic       self.interaction.setContentsRectNeedsUpdate()     }   } } extension ViewController: ImageAnalysisInteractionDelegate {   func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? {     return nil   }       func contentsRect(for interaction: ImageAnalysisInteraction) -> CGRect {     // >>> This method is never being called <<<     return CGRect(x: 0, y: 0, width: 1.0, height: 0.7)   }       func contentView(for interaction: ImageAnalysisInteraction) -> UIView? {     return nil   }       func interaction(_ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) {     debugPrint("highlight: \(highlightSelectedItems)")   } }
1
0
1.2k
Aug ’22
Enable Live Text on PDFKit
Hi! I watched WWDC2022's 10089 session "What's New in PDFKit?" where it's said that Live Text is now compatible with PDFKit. However, I can't seem to find anything related to it in documentation or code. ImageAnalyzer needs an UIImage to work. But that would mean retrieve the current PDFPage and then convert it to UIImage which is a performance hog. How can I enable Live Text in PDFKit? thanks.
Replies
1
Boosts
0
Views
1.7k
Activity
Aug ’22
How to get auto-suggested word based on drawn Chinese character or stroke info in the form of an array of CGPoint?
I have an array consists of the CGPoint representing the chinese character stroke paths and able to re-draw out the character on UIView. I would like to use this existing information to find out the most similar chinese word. I notice the chinese keyboard hand-writing pad can display the suggested words. However, I have no idea which functions in the documentation that get this to work ( pass the stroke info as CGPoint, and get back suggested Chinese words). What API calls can I use to get the suggested words?
Replies
0
Boosts
0
Views
1.7k
Activity
Aug ’22
ImageAnalysisInteraction doesn't call contentsRect delegate's method
Hello, I am struggling with an issue that contentsRect(for:) method of ImageAnalysisInteractionDelegate is not being called at any moment. I've set up the demo project where the interaction is added to root view of view controller while I'm analyzing the image of UIImageView that is added to this view. I want to achieve the behavior where I could define contents rect for highlights of found text on that image. P.S. I know that I could simply add an interaction to an image view but that's not the case - the real work that I want to achieve in the real project is to display live text on paused video player, so that image view here is for simplicity only. import UIKit import VisionKit class ViewController: UIViewController {       private let imageView = UIImageView()       private let imageAnalyzer = ImageAnalyzer()   private let interaction = ImageAnalysisInteraction()   override func viewDidLoad() {     super.viewDidLoad()           view.addSubview(imageView)     imageView.translatesAutoresizingMaskIntoConstraints = false           NSLayoutConstraint.activate([       imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor),       imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor),       imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor),       imageView.heightAnchor.constraint(equalTo: view.heightAnchor, multiplier: 0.7)     ])           interaction.delegate = self       // Some image with text that I have in assets     imageView.image = UIImage(named: "IMG_5564")     imageView.contentMode = .scaleAspectFit           view.addInteraction(interaction)           interaction.setContentsRectNeedsUpdate()           DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {       self.analyze()     }   }       private func analyze() {     Task {       let imageAnalysis = try? await imageAnalyzer.analyze(         self.imageView.image!,         configuration: .init([.machineReadableCode, .text])       )               self.interaction.analysis = imageAnalysis       self.interaction.preferredInteractionTypes = .automatic       self.interaction.setContentsRectNeedsUpdate()     }   } } extension ViewController: ImageAnalysisInteractionDelegate {   func presentingViewController(for interaction: ImageAnalysisInteraction) -> UIViewController? {     return nil   }       func contentsRect(for interaction: ImageAnalysisInteraction) -> CGRect {     // >>> This method is never being called <<<     return CGRect(x: 0, y: 0, width: 1.0, height: 0.7)   }       func contentView(for interaction: ImageAnalysisInteraction) -> UIView? {     return nil   }       func interaction(_ interaction: ImageAnalysisInteraction, highlightSelectedItemsDidChange highlightSelectedItems: Bool) {     debugPrint("highlight: \(highlightSelectedItems)")   } }
Replies
1
Boosts
0
Views
1.2k
Activity
Aug ’22
Is it possible to get the bounding box locations for selected text in Live Text (VisionKit)?
I’m using visionKit to create a "LiveText" overlay on a UIImageView. This functionality has been added in IOS 16. I understand I can get bounding boxes for all text recognized, but I only want the bounding boxes for the selected text. Is this possible?
Replies
0
Boosts
0
Views
1k
Activity
Aug ’22
Apple Translate URL Scheme
Does anyone know the URL scheme for calling Apple Translate?
Replies
0
Boosts
0
Views
1.1k
Activity
Jul ’22
Vibrate when call is received
Is Apple Provide “Vibrate when call is received” feature in ios16?
Replies
0
Boosts
0
Views
750
Activity
Jun ’22
Where to find the feature about Live Text API in WebKit?
I found webkit is mentioned in wwdc2022-10026,but not more information provide?I would like to know where I can collect related resource!Please~ https://developer.apple.com/videos/play/wwdc2022/10026/
Replies
0
Boosts
0
Views
1.3k
Activity
Jun ’22
How can I use Live Text API in SwiftUI
Could anyone here tell me how I can use Live Text API in SwiftUI ? The code provide uses UIKit and not complete, the code is for existing project, but I want to develop a new SwiftUI project, so I have no idea how to implement it.
Replies
2
Boosts
0
Views
2.5k
Activity
Jun ’22