Can i use photo for keyboard input in my app

now ,i can use camera for input, but ,maybe user want to use some photo for keyboard input.

why can't i open photo library when i open camera.

class ViewController: UIViewController {



    @IBOutlet weak var contentLabel: UILabel!

    @IBOutlet weak var inputTextField: UITextField!

    @IBOutlet weak var cameraButtonView: UIView!

    

    override func viewDidLoad() {

        super.viewDidLoad()

        let textFromCamera = UIAction.captureTextFromCamera(responder: contentLabel, identifier: nil)

        let cameraButton = UIButton(primaryAction: textFromCamera)

        cameraButton.frame = cameraButtonView.bounds

        cameraButton.setTitle("", for: .normal)

        cameraButton.setImage(.init(systemName: "camera.fill"), for: .normal)

        cameraButtonView.addSubview(cameraButton)

    }

}

extension UILabel: UIKeyInput {

    public var hasText: Bool {

        text != nil && text!.count > 0

    }

    public func insertText(_ text: String) {

        self.text = text

    }

    public func deleteBackward() { }

}
Answered by in 677774022

why can't i open photo library when i open camera.

Sorry! That's not possible, at least not this year. Sounds like a great feature idea though!

Accepted Answer

why can't i open photo library when i open camera.

Sorry! That's not possible, at least not this year. Sounds like a great feature idea though!

Can i use photo for keyboard input in my app
 
 
Q