File

public struct File

A file type.

  • Create a File.

    Declaration

    Swift

    public init(name: String, data: Data)

    Parameters

    name

    the name of the file.

    data

    the data of the file.

  • Create a File from a given image.

    Declaration

    Swift

    init?(name: String, jpegImage: Image, compressionQuality: CGFloat = 0.9)

    Parameters

    name

    the name of the image.

    jpegImage

    the image, that would be converted to a JPEG data.

    compressionQuality

    The quality of the resulting JPEG image, expressed as a value from 0.0 to 1.0. The value 0.0 represents the maximum compression (or lowest quality) while the value 1.0 represents the least compression (or best quality). Default: 0.9.

  • Create a File from a given image.

    Declaration

    Swift

    init?(name: String, pngImage: Image)

    Parameters

    name

    the name of the image.

    pngImage

    the image, that would be converted to a PNG data.

  • A helper function to create File‘s from images in working thread.

    Declaration

    Swift

    static func files(from images: [Image],
                             process: @escaping (_ index: Int, _ image: Image) -> File?,
                             completion: @escaping (_ files: [File]) -> Void)

    Parameters

    images

    a list of Image‘s.

    process

    a process block to create a File from a given Image. The block can return nil an image needs to skip.

    completion

    a completion block with a list of File‘s (could be empty, if images didn’t converted to File’s. ).