BasicAttachmentDelegate
open class BasicAttachmentDelegate : AttachmentDelegate
Basic implementation of AttachmentDelegate protocol. This is a local folder based implementation. The implementation allows Apps to store attachment locally along with the Apps, The implementation also allows Apps to further customize uploading behavoirs by overriding functions.
-
Default folder
Declaration
Swift
public static let demoFolderName: String
-
Convince property for Apps to get local folder
Declaration
Swift
public let localFolder: URL
-
Undocumented
Declaration
Swift
public init(localFolderName: String? = nil, onPreparation: ((URL) -> Void)? = nil)
-
Delete attachment identified by an URL asynchronously.
Declaration
Swift
open func delete(url: URL, onCompletion: @escaping (URL, (any Error)?) -> Void)
-
Upload an attachment, content of which is provided by an NSItemProvider asynchronously.
Declaration
Swift
open func upload(contentFrom provider: NSItemProvider, onCompletion: @escaping (URL?, Error?) -> Void)
-
Save an attachment to local folder asynchronously. The local copy is identifed by the URL.
Declaration
Swift
open func saveLocally(url: URL, identifier: String, onCompletion: @escaping (URL?, Error?) -> Void)
-
Get targert file name in local folder for avoiding conflicts by appending random UUID to file name when conflicts are detected.
Declaration
Swift
open func getAttachmentNameAndExt(from url: URL, utTypeidentifier identifier: String) throws -> URL
-
infer attachment file name from URL components.
Declaration
Swift
open func getOrInferExt(extension ext: String, utTypeidentifier identifier: String) -> String