Saving and Storing Electronic Signatures on iOS
PSPDFKit allows you to implement your own mechanism for storing signatures.
If you provide such a mechanism, then signatures may optionally be saved at the same time they’re added to a document. The saving of signatures is based on the signatureSavingStrategy
: This defaults to showing a toggle in the UI that allows the user to choose whether to save, but you can change this option to hide the toggle and instead always save signatures without giving the user the choice.
If you provide stored signatures to PSPDFKit, then when the user selects a signature form field or the signature tool, the list of stored signatures will be shown instead of the signature creation UI.
SignatureStore
can be used to create your own solution for storing and retrieving signatures. A signature store can be provided when initializing PDFViewController
to make user-created signatures savable.
By default, no signature store is provided. If you want to use the built-in storage solution that uses the keychain, you can use a setup like this:
let controller = PDFViewController(document: document) { builder in builder.signatureStore = KeychainSignatureStore() }
However, you can also create your own storage by implementing a class that conforms to the SignatureStore
protocol. To conform to this protocol, you’ll need to handle adding, removing, and retrieving existing signatures from your custom store. addSignature(_:)
will be called whenever the user has created a signature and enabled saving this signature in the signing UI.