feat(camera): add plugin for Android and iOS

This commit is contained in:
Lucas Nogueira
2023-02-17 17:38:04 -03:00
parent 22f987bf24
commit 2f3dde35b3
105 changed files with 8317 additions and 0 deletions
@@ -0,0 +1,20 @@
import UIKit
class ImageSaver: NSObject {
var onResult: ((Error?) -> Void) = {_ in }
init(image: UIImage, onResult:@escaping ((Error?) -> Void)) {
self.onResult = onResult
super.init()
UIImageWriteToSavedPhotosAlbum(image, self, #selector(saveResult), nil)
}
@objc func saveResult(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {
if let error = error {
onResult(error)
} else {
onResult(nil)
}
}
}