I'm currently working on a medical research app in swift, based on the ResearchKit framework (which is written in objective-c). I have the signature assigned to the consent document and I'm trying to create a PDF using makePDFWithCompletionHandler and email it. This is the completion handler I currently have for the consent task in my view controller:
func taskViewController(taskViewController: ORKTaskViewController, didFinishWithReason reason: ORKTaskViewControllerFinishReason, error: NSError?) {
taskViewController.dismissViewControllerAnimated(true, completion: nil)
if reason == .Completed {
ConsentDocument.makePDFWithCompletionHandler(/*Completion handler Block*/){
//Email pdf code here
}
}
}
I cannot figure out what to put as the completion handler block. Also, I can't find code to email the pdf once it is created.
In my consent task, I have the following code to assign the signature to the document:
let signatureResult = ORKConsentSignatureResult(identifier: "ConsentDocumentParticipantSignature")
signatureResult.applyToDocument(ConsentDocument)