https://kotlinlang.org logo
#ios
Title
# ios
d

Deividas Strioga

03/21/2024, 10:51 PM
Hey, I am trying to understand if all classes of iOS native libs have kotlin/native wrappers. e.g. I want to use some VisionKit classes like DataScannerViewController. But when looking at the kotlin native VisionKit packages, I only see a few classes, like VNDocumentCameraViewController. This one is available from iOS 13, while the one I am looking for is available from iOS 16. I thought I need to bump my iOS app min build version to 16, but after doing that and rebuilds, I still do not see more classes in
VisionKit
of kotlin/native. Do I have to do something else, or simply not all the classes get kotlin wrappers? And is there any other way to use the remaining VisionKit classes? Thanks in advance.
a

a-dd

03/22/2024, 12:16 PM
Hi Deividas, not all the iOS SDK frameworks (and symbols from them) are supported, although we are trying to support as many as possible. In this case, in the existing Kotlin versions it's not possible to import
DataScannerViewController
, Could you file an issue to https://kotl.in/issue?
As a workaround, I think it could be possible to define custom
cinterop
(https://kotlinlang.org/docs/multiplatform-dsl-reference.html#cinterops) with it, but you'll need to generate manually
VisionKit-Swift.h
from the
VisionKit.swiftmodule
upd. it looks like
DataScannerViewController
is Swift-only API (despite
@objc
) and therefore cannot be called from Kotlin: https://forums.developer.apple.com/forums/thread/711569
d

Deividas Strioga

03/22/2024, 9:44 PM
Thank you 🙇
2 Views