FUIAttachmentsViewController

open class FUIAttachmentsViewController : UIViewController, QLPreviewControllerDataSource

The FUIAttachmentsViewController manages the presentation of a collection of attachment thumbnails, and previews of specific files.

Configuration

Developers should implement the FUIAttachmentsViewControllerDataSource and FUIAttachmentsViewControllerDelegate, to supply content to the controller, and handle events.

Attachment Actions

The controller also supports presentation of an Add Attachment action sheet, which displays a list of FUIAttachmentAction options. Attachment actions are typically used for acquiring (adding) attachments. Default FUIAttachmentAction implementations are provided, for obtaining data from the camera, or photo albums. Developers should add FUIAttachmentAction instances to the controller, using addAttachmentAction(action:).

Presenting Attachment Previews

The FUIAttachmentsViewController uses a native QLPreviewController to present file previews, when the user taps on an attachment icon. The QLPreviewController requires a valid file URL, and will request the URL for a selected attachment, in the FUIAttachmentsViewControllerDataSource urlForAttachmentAtIndex: method. If the developer returns nil, or, if the QLPreviewController cannot handle the URL provided, then the FUIAttachmentsViewControllerDelegate couldNotPresentAttachmentAtIndex: method will be invoked. The developer should handle the presentation for these cases, using a custom view controller, or other presentation framework.

  • Instantiate an FUIAttachmentsFormViewController.

    Declaration

    Swift

    open class func instantiateViewController() -> FUIAttachmentsViewController

    Return Value

    An instance of an FUIAttachmentsFormViewController loaded from storyboard.

  • Gets the number of actions in the action list.

    Declaration

    Swift

    open func numberOfAttachmentActions() -> Int

    Return Value

    The number of actions in the action list.

  • Add an FUIAttachmentAction to action list.

    Declaration

    Swift

    public func addAttachmentAction(_ action: FUIAttachmentAction)
  • Remove an FUIAttachmentAction in action list.

    Declaration

    Swift

    public func removeAttachmentAction(at index: Int)

    Parameters

    index

    The position of the action to be removed.

  • Removes all registered attachment type actions.

    Declaration

    Swift

    public func removeAllAttachmentActions()
  • Reloads data in the view

    Declaration

    Swift

    public func reloadData()