@objcMembers @objc(PESDKPhoto) public final class Photo : NSObject
An object that wraps different types of image data.
Photo class currently supports
UIImage as sources for photos.
The image type to choose depends on where the image comes from:
URLfor image files on disk.
Datafor images from the web.
UIImageonly if the image was already used in the UI.
Data will have the least amount of memory footprint because we will do
the image scaling without reading the full image if possible. We also try to do this with
UIImage, however if the instance of
UIImage represents a wide-color image we will have to
read the full image which can lead to memory pressure for large images.
If memory is still an issue when using
Data objects, it is recommended that you write the data
to disk and initialize a
Photo with a file url instead.
Data is used we are also able to keep any associated EXIF data, which
does not support.
The data format can be any image format that can be read by iOS, for example PNG, JPEG or HEIF.
NoteYou don’t have to pre-scale your image because we’re already doing any work that is necessary.
The url that this photo was initialized with if any.
public let url: URL?
The data object that this photo was initialized with if any.
public let data: Data?
The image object that this photo was initialized with if any.
public let image: UIImage?
Creates a new photo from the given url.
@objc(initWithURL:) public init(url: URL)
The url to the image on disk.
Creates a new photo from the given data.
public init(data: Data)
The data of the image.
Creates a new photo from the given
public init(image: UIImage)