Import PDFs and images

If you want to add the File import feature on your app, first you need to specify the supported types (fileImportSupportedTypes) on the GiniConfiguration instance.

let giniConfiguration = GiniConfiguration.shared
giniConfiguration.fileImportSupportedTypes = .pdf_and_images

These are the cases for file import supported file types:

  • pdf
  • pdf_and_images
  • none (In case you want to disable File import funcionality, including UI related. This is the default value).

Also if you want to add some custom validations for the imported GiniCaptureDocument, you can specify them in the GiniConfiguration closure, customDocumentValidations. Here is an example:

giniConfiguration.customDocumentValidations = { document in
    // As an example of custom document validation, we add a more strict check for file size
    let maxFileSize = 5 * 1024 * 1024 // 5MB
    if document.data.count > maxFileSize {
        throw DocumentValidationError.custom(message: "Diese Datei ist leider größer als 5MB")
    }
}

Import images from camera roll

To enable your app to import images from Photo Gallery and also support iOS 10 you need to specify the NSPhotoLibraryUsageDescription key in your Info.plist file. This key is mandatory for all apps since iOS 10 when accessing the Photo Gallery.

Import images and PDFs from other apps

In order to enable your app to import PDFs and images from other apps like Files, Dropbox or Drive, you need to enable iCloud document support in your app.

For more information take a look at Incorporating iCloud into Your App guide from Apple documentation.