Manual Selfie
You can access the Selfie
module from the base Amani
class as shown below.
caution
Before using this module please make sure you've initialized the SDK correctly.
let amaniSelfie = Amani.sharedInstance.Selfie()
Starting the Selfie capture
The start
method will return an instance of UIView
.
self.selfieView = amaniSelfie.start() {[weak self] previewImage in
// after the process ends you can safely remove the selfieView from your view controller
DispatchQueue.main.async {
self.selfieView.removeFromSuperview()
}
// TODO: upload or show a confirm screen
}
// don't forget to add the selfie view to your view controller
DispatchQueue.main.async {
self.view.addSubview(self.selfieView)
}
Upload
After completing the capture proccess you can call the upload as shown below.
amaniSelfie.upload(location: nil) {[weak self] uploadSuccess in
if (uploadSuccess != nil) {
// uploadSuccess is a boolean variable
// TODO: handle the upload state
}
}