Hi guys! I have written a native iOS code in Xcode...
# multiplatform
y
Hi guys! I have written a native iOS code in Xcode using Swift to save an image to the photo library in a custom album. I want to call this code from my Kotlin code in the iOS Main module, but I'm not sure how to do it. Is it possible to call Swift code from Kotlin in a Kotlin Multiplatform project? If so, how can I achieve this? Kotlin Code:
Copy code
actual fun downloadImageFromUrl(url: String, id: String): Flow<Boolean?> = flow {
    // TODO: Call Swift code to download image and save to photo library in a custom album
}
Swift Code (to be called from Kotlin):
Copy code
UIImage.load(from: URL(string: url)) { image in
    if let image = image {
        ThematicaPhotoAlbum.sharedInstance.createAlbum(image: image)
    } else {
        print("Image loading failed. Please try again.")
    }
}