UNNotificationAttachment

extension UNNotificationAttachment

Creates an attachment for the data at URL with an optional options dictionary. URL must be a file URL. Returns nil if the data at URL is not supported.

  • Convenience init for UNNotificationAttachment that accepts an image Data, saves the image on a temporary directory on the device, then returns a UNNotificationAttachment with the said image.

    Declaration

    Swift

    public convenience init(identifier: String, data: Data, options: [NSObject : AnyObject]? = nil) throws

    Parameters

    identifier

    Filename that will be used when storing the image

    data

    Image data

    options

    A dictionary of options related for the file that will be created

    Return Value

    The created UNNotificationAttachment with an image.