Can we access Swift classes from shared code, or i...
# multiplatform
m
Can we access Swift classes from shared code, or is it just "foundation" classes, and what's the definition of those if that's the case? What I really want is Swift's Path class, but suppose I could settle for CGPath
m
There's no interop with Swift. It's possible to interop with Swift code if they are using
@objc
to be usable from Objective-C. CGPath is part of Core Graphics so that is one of the interops Kotlin provides for you out of the box, so you can use it. Import from
platform.CoreGraphics
🙏 2
k
The easiest way to use Swift is to make an interface in Kotlin and pass in an implementation from Swift on app start. I'm not familiar with Path or your use case, so I can't say that this makes sense, but it's often what I do if cinterop is going to be a hassle and/or if something isn't available.
m
Thanks for that @kpgalligan, I'm going to have to think about that. I may (well) have more questions later 🤔