I am currently writing a multi-platform mobile application for a conference (Android and iOS, both w...
m
I am currently writing a multi-platform mobile application for a conference (Android and iOS, both with Compose GUI). The app itself already works perfectly but I now have to integrate a QR-code scanner into it. I also have that working for Android but I have to admit that I have no idea how to do that for iOS. Could anybody provide me with an example of that? I also do not yet have a real iOS device, so I hope that I can test that with the iOS simulator like I did for Android (although I do of course have several Android devices for testing 😉).
r
I have used this SwiftUI library: https://github.com/twostraws/CodeScanner. Might give you some ideas even if you don't use it directly.
m
Could this be used directly from Kotlin? As I said I did not do the GUI in SwiftUI.
r
Not that project directly, no. But it might give you some ideas you can use to call the underlying APIs.
l
Compose for iOS doesn't currently support UIKit integration.
You can potentially get the camera pixel data and use drawBehind to draw into a native canvas. Keep in mind that iOS simulators do not have camera support, however.
t
@Michael Paus do you have a solution for this case? my app has a same use case but I don’t know I can include an iOS UIController inside compose or not
m
Not yet, but at the moment I am also busy with other stuff which is holding me up.
l
If you look at my experimental repo github.com/LandryNorris/PlatformView, I found a way to draw a UIView into compose for iOS. It currently requires you to invalidate it manually, but for a camera, that should happen every frame, so you could just have a timer increment a variable.