How to return to the original app after scanning a barcode in the custom keyboard app

We are developing a custom keyboard with barcode scanning functionality in Swift. We are aware that the camera function cannot be used on the custom keyboard due to iOS security, so we are implementing a combination of the custom keyboard app & a hosting app that handles scanning and settings. The hosted apps that can use the keyboard app are not limited, but are assumed to be used by an unspecified number of apps such as Notepad, Safari, etc.


After displaying the keyboard app in the host app, I am able to press the button displayed in the keyboard app → transition to the hosting app with a custom URL scheme to scan the barcode, but I am unsure how to return to the host app from here. I am aware that there is some way to get back to the host app, as the following app I referred to is able to achieve this.

https://apps.apple.com/jp/app/imagerswift/id1469166411


We have investigated and verified the following three points

  1. whether it is possible to come back to the keyboard app with a custom URL scheme

→The keyboard app does not allow custom URLs to be set.

  1. Can we return to the host app with a custom URL scheme?

→The keyboard app cannot recognize which app is the host app.

  1. Is it possible to press the Back to xxxx link that appears in the upper left corner of the screen as an iOS function?

→Cannot be controlled from the app.

How to return to the original app after scanning a barcode in the custom keyboard app
 
 
Q