FUIAddPhotoLibraryItemsAttachmentAction

@available(iOS 14.0, *)
open class FUIAddPhotoLibraryItemsAttachmentAction : FUIAttachmentAction
extension FUIAddPhotoLibraryItemsAttachmentAction: PHPickerViewControllerDelegate

This class is an implementation of FUIAttachmentAction to allow users to choose items using PHPickerViewController from the Photo Library as attachments in FUIAttachmentsFormView.

The implementation uses a PHPickerViewController to let user choose items from Photo Library.

  • The title string to be displayed for this action.

    Declaration

    Swift

    public let title: String
  • Declaration

    Swift

    open weak var delegate: FUIAddPhotoLibraryItemsAttachmentActionDelegate?
  • The types of media that are allowed.

    Use this property to customize the media types allowed for this attachment action.

    If this is not specified, the default is:

    [kUTTypeMovie as String, kUTTypeImage as String]
    

    This means both video and photo are allowed to be chosen.

    Constants kUTTypeMovie and kUTTypeImage are defined in MobileCoreServices.

    Declaration

    Swift

    @available(*, deprecated, message: "Use `phPickerConfiguration` property instead")
    open var mediaTypes: [String]?
  • The PHPickerConfiguration configuration to be used for the PHPickerViewController.

    The default configuration allows selection for photos, live photos, and videos. And its selectionLimit is default to 1. Also, it is limited to the max number of attachments minus the current number of attachments.

    Declaration

    Swift

    open var phPickerConfiguration: PHPickerConfiguration
  • Returns a newly initialized FUIAddPhotoAttachmentAction.

    Declaration

    Swift

    public convenience init()
  • Returns a newly initialized FUIAddPhotoAttachmentAction.

    Declaration

    Swift

    public init(withTitle title: String? = nil)

    Parameters

    title

    The title string for this action. If this is not specified, the default title “Photo Library” will be used.

  • A photo picker will be displayed to allow the user to choose a photo as an attachment.

    Declaration

    Swift

    open func action(onController controller: FUIAttachmentsViewController)

    Parameters

    controller

    The FUIAttachmentsFormViewController.

  • Check if Photo Library is available or not.

    Declaration

    Swift

    open func isAvailable(_ alertAction: UIAlertAction) -> Bool

    Return Value

    True if photo library is available.

  • Declaration

    Swift

    public func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult])