FUIAttachmentsViewController
@MainActor
open class FUIAttachmentsViewController : UIViewController, QLPreviewControllerDataSource, QLPreviewControllerDelegate
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.
Theming
Supported style classes
fdlFUIAttachmentsViewController
fdlFUIAttachmentsViewController_alertActionTitle
-
Declaration
Swift
@MainActor open weak var delegate: FUIAttachmentsViewControllerDelegate? -
Declaration
Swift
@MainActor open weak var dataSource: FUIAttachmentsViewControllerDataSource? -
Indicates if user can add attachment or not. If this is true, there will be a “+” button shown. When user tapped that button, it will bring up the “Add Attachment” pop-up for user to select additional attachment. Otherwise, the “+” button will not be shown. The default is true.
Declaration
Swift
@MainActor public var isEditable: Bool { get set } -
Undocumented
Declaration
Swift
@MainActor public var isEnabled: Bool { get set } -
Indicates whether the cell is a mandatory field.
The default value is
false.Declaration
Swift
@MainActor open var isRequired: Bool { get set } -
Indicates the field is a mandatory field.
The default value is
*.Declaration
Swift
@MainActor public var mandatoryIndicator: FUIText { get set } -
This property indicates the modal presentation style for the camera screen. If the developer doesn’t set this value, the default modal presentation style is
currentContext.Declaration
Swift
@MainActor public var cameraModalPresentationStyle: UIModalPresentationStyle? -
This property indicates the maximum number of attachments. The “Add” button will not be shown if the number of attachments reaches the limit in the editable mode. There is no limit when this value is less than or equal to 0. The default value is 0.
Declaration
Swift
@MainActor open var maxItems: Int { get set } -
Set this property to customize the title for this attachment cell. If this property is not set, the default title displays. The default title format is “Attachment (%d)” where %d is the number of attachments already selected.
Declaration
Swift
@MainActor public var customAttachmentsTitleFormat: String? -
The customized string to be displayed for canceling the “Add Attachment” actions. The default is “Cancel”.
Declaration
Swift
@MainActor public var customCancelString: String? -
The customized pop up title string when user tapped Add Attachment button. The default string is “Add Attachment”
Declaration
Swift
@available(*, deprecated, message: "This property is kept for backwards-compatibility, but has no effect on the view") @MainActor public var customPopupTitleString: String? -
Indicator for showing the alert when deleting current attachment. Default value is
false.Declaration
Swift
@MainActor public var showAlertWhenDeleting: Bool -
Undocumented
Declaration
Swift
@MainActor open override func viewIsAppearing(_ animated: Bool) -
Instantiate an
FUIAttachmentsFormViewController.Declaration
Swift
@MainActor open class func instantiateViewController() -> FUIAttachmentsViewControllerReturn Value
An instance of an
FUIAttachmentsFormViewControllerloaded from storyboard. -
Gets the number of actions in the action list.
Declaration
Swift
@MainActor open func numberOfAttachmentActions() -> IntReturn Value
The number of actions in the action list.
-
Add an
FUIAttachmentActionto action list.Declaration
Swift
@MainActor public func addAttachmentAction(_ action: FUIAttachmentAction) -
Remove an
FUIAttachmentActionin action list.Declaration
Swift
@MainActor public func removeAttachmentAction(at index: Int)Parameters
indexThe position of the action to be removed.
-
Removes all registered attachment type actions.
Declaration
Swift
@MainActor public func removeAllAttachmentActions() -
Reloads data in the view
Declaration
Swift
@MainActor public func reloadData() -
Use this function to register custom
UICollectionViewCellclass to thisFUIAttachmentsViewController.Declaration
Swift
@MainActor public func register(_ attachmentCellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)Parameters
attachmentCellClassThe class of a cell that you want to use to display the attachment.
identifierThe reuse identifier to associate with the specified class.
-
Use this function to dequeue a reusable custom
UICollectionViewCellclass to display the attachment.Declaration
Swift
@MainActor public func dequeueReusableCell(withReuseIdentifier identifier: String, forAttachment index: Int) -> UICollectionViewCellParameters
identifierThe reuse identifier for the specified cell.
indexThe attachment index.
Return Value
The corresponding
UICollectionViewCellfor theidentifier. -
The
QLPreviewControllerto preview the attachments.FUIAttachmentsViewControllerallocates a defaultQLPreviewController. Developers may set this property to their own customizedQLPreviewControllerif desired.Declaration
Swift
@MainActor public var previewController: QLPreviewController { get set } -
Open the item of the specified attachment at the given index.
Declaration
Swift
@MainActor public func openAttachmentItem(index: Int)Parameters
indexThe index of the item.