SessionImage

@objcMembers
public class SessionImage : NSObject, Codable

For more information see Session documentation.

Image Size

  • The pixel dimensions of the original image. Does not take into account the preferredTransform.

    Declaration

    Swift

    public internal(set) var naturalSize: CGSize { get }
  • The pixel dimensions of the original image with the preferredTransform taken into account.

    Declaration

    Swift

    public var actualSize: CGSize { get }
  • The pixel dimensions of the final image.

    If there is a cropRect, this will be equal to the size of the cropRect. Otherwise it is equal to the actualSize.

    Declaration

    Swift

    public var renderSize: CGSize { get }

Rotation and Cropping

  • The preferredTransform takes into account any rotation that should be made to the image.

    If the image originally came with an orientation, it will be converted into the preferredTransform.

    Any rotation made by the EditController will also be reflected here.

    Default value: .identity

    Declaration

    Swift

    public var preferredTransform: CGAffineTransform { get set }
  • The cropRect defines which region of the image should be the final image.

    The cropRect is placed inside the image after the preferredTransform is applied. The image size will be the actualSize and the origin is top left corner. The cropRect is in pixels.

    Default value: nil

    Declaration

    Swift

    public var cropRect: CGRect? { get set }

Current Filters

  • The active primary filter. This will be set when a filter is selected from the EditController Filter tab.

    Declaration

    Swift

    public var primaryFilter: SessionFilter? { get set }
  • All active filters not including the primaryFilter. The EditController Adjust tab will place filters here.

    The filters in this array will be applied in ascending order.

    Declaration

    Swift

    public var filters: [SessionFilter] { get set }

Location Data

  • If the image came from the users Photo Library and there was location information associated, this will be set.

    See the documentation for CLLocation.

    Default value: nil

    Declaration

    Swift

    public var location: CLLocation?
  • If the image came from the users Photo Library and there was location information associated, this will be equal to the latitude value of the location coordinate.

    The latitude is in degrees. Positive values indicate latitudes north of the equator. Negative values indicate latitudes south of the equator.

    Default value: self.location?.coordinate.latitude

    Declaration

    Swift

    public var latitude: Double? { get }
  • If the image came from the users Photo Library and there was location information associated, this will be equal to the longitude value of the location coordinate.

    The longitude is in degrees. Measurements are relative to the zero meridian, with positive values extending east of the meridian and negative values extending west of the meridian.

    Default value: self.location?.coordinate.longitude

    Declaration

    Swift

    public var longitude: Double? { get }

Export Status

  • The URL location of the final JPEG image file after it has been exported. There will only be a file here after an export has been completed. You may move, copy or delete this file. See ImageExporter for more information.

    Declaration

    Swift

    public var exportedImageURL: URL { get }
  • The UTC date when the last successful image export started.

    Declaration

    Swift

    public internal(set) var dateExported: Date? { get }
  • Indicates if the export was completed.

    If the sessions dateModified is an older date than the images dateExported, this will be false. In other words, if you export the image this will become true but if you then make modifications to the session this will flip back to false. The exportedImageURL file must also exist for this to be true.

    Declaration

    Swift

    public var isExported: Bool { get }

Generating Thumbnails

  • Retrieves a thumbnail for the image. Thumbnails do not include filters, unless you manually pass a SessionFilter to this function.

    If the thumbnail has not been retrieved before it will be generated and cached. If it has been retrieved before, it will be pulled from cache. Cache persists after restart.

    Declaration

    Swift

    public func requestThumbnail(boundingSize: CGSize, contentMode: ContentMode, filter: SessionFilter? = nil, completion: @escaping ((UIImage?) -> Void))

    Parameters

    boundingSize

    The size in pixels you would like to restrict the thumbnail to. The maximum size you can request is 400x400 pixels.

    contentMode

    The contentMode will control how the thumbnail is filled or fit into the size. Content will not be clipped to bounds.

    filter

    An optional SessionFilter to apply to the thumbnail.

    completion

    Called when the thumbnail has been retrieved.

  • Clears the thumbnail cache.

    Declaration

    Swift

    public func invalidateThumbnails()