Class

INImage

Image data inside an Intents extension or Intents UI extension.

Declaration

class INImage : NSObject

Overview

An INImage object is a wrapper for image data that you include in a response to an intent. When providing a response to an intent, you must specify any image parameters using instances of this class. You can create INImage objects from images you have locally in your extension or located on a remote server. Image objects support the same formats as the underlying platform, but use PNG images whenever possible.

When confirming or handling an intent, you provide a response object with details about how your app handles that intent. When a response object contains an image, use the imageSize(for:) method of this class to determine the required image size, and then create an instance of this class with the corresponding image data.

Topics

Creating an Image Object

init(named: String)

Creates an image object whose contents are taken from the specified name.

init(uiImage: UIImage)

Creates an image object from an existing UIKit image.

init(cgImage: CGImage)

Creates an image object from an existing Core Graphics image.

init?(url: URL)

Creates an image object from the image at the specified URL.

init(imageData: Data)

Creates an image object using the specified data.

init?(url: URL, width: Double, height: Double)

Creates an image object from the data at the specified URL and sizes it to the desired width and height.

Getting the Image

func fetchUIImage(completion: (UIImage?) -> Void)

Delivers the image to the specified completion handler.

Getting the Preferred Image Size

class func imageSize(for: INIntentResponse) -> CGSize

Returns the preferred size for an image to be used with the specified response object.

Relationships

Inherits From