DocumentPickerCoordinator
public final class DocumentPickerCoordinator : NSObject
extension DocumentPickerCoordinator: UIDocumentPickerDelegate
extension DocumentPickerCoordinator: UIDropInteractionDelegate
The DocumentPickerCoordinator class allows you to present both the gallery and file explorer or to setup drag and drop
in a view. If you want to handle the picked elements, you have to assign a DocumentPickerCoordinatorDelegate
to
the delegate
property.
When using multipage and having imported/captured images, you have to update the isPDFSelectionAllowed
property before showing the File explorer in order to filter out PDFs.
-
The object that acts as the delegate of the document picker coordinator.
Declaration
Swift
public weak var delegate: DocumentPickerCoordinatorDelegate?
-
Used to filter out PDFs when there are already imported images.
Declaration
Swift
public var isPDFSelectionAllowed: Bool
-
Once the user has selected one or several documents from a picker, this has to be dismissed. Files explorer dismissal is handled by the OS and drag and drop does not need to be dismissed. However, the Gallery picker should be dismissed once the images has been imported.
It is also used to check if the
currentPickerViewController
is still present so an error dialog can be shown fro thereDeclaration
Swift
public private(set) var currentPickerDismissesAutomatically: Bool { get }
-
The current picker
UIViewController
. Used to show an error after validating picked documents.Declaration
Swift
public private(set) var currentPickerViewController: UIViewController? { get }
-
Indicates if the user granted access to the gallery before. Used to start caching images before showing the Gallery picker.
Declaration
Swift
public var isGalleryPermissionGranted: Bool { get }
-
Designated initializer for the
DocumentPickerCoordinator
.Declaration
Swift
public init(giniConfiguration: GiniConfiguration)
Parameters
giniConfiguration
GiniConfiguration
use to configure the pickers. -
Starts caching gallery images. Gallery permissions should have been granted before using it.
Declaration
Swift
public func startCaching()
-
Set up the drag and drop feature in a view.
Note
Only available in iOS >= 11Declaration
Swift
public func setupDragAndDrop(in view: UIView)
Parameters
view
View that will handle the drop interaction.
-
Shows the Gallery picker from a given viewController
Declaration
Swift
public func showGalleryPicker(from viewController: UIViewController)
Parameters
viewController
View controller which presentes the gallery picker
-
Shows the File explorer picker from a given viewController
Declaration
Swift
public func showDocumentPicker(from viewController: UIViewController, device: UIDevice = UIDevice.current)
Parameters
viewController
View controller which presentes the gallery picker
-
Dimisses the
currentPickerViewController
Declaration
Swift
public func dismissCurrentPicker(completion: @escaping () -> Void)
Parameters
completion
Completion block executed once the picker is dismissed
-
Undocumented
Declaration
Swift
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL])
-
Undocumented
Declaration
Swift
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentAt url: URL)
-
Undocumented
Declaration
Swift
public func documentPickerWasCancelled(_ controller: UIDocumentPickerViewController)
-
Undocumented
Declaration
Swift
public func dropInteraction(_ interaction: UIDropInteraction, canHandle session: UIDropSession) -> Bool
-
Undocumented
Declaration
Swift
public func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal
-
Undocumented
Declaration
Swift
public func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession)