Class

CLKImageProvider

An image displayed by a complication.

Overview

You create an image provider with at least one image and may specify two additional images to use under certain conditions. The images you specify are template images that have a color applied to them prior to display. The clock face displaying the complication determines how the images are composited together and which tint color is applied.

Every image provider must contain a one-piece image, which is comprised of a single template image. In multicolor clock faces, ClockKit applies the color in the tintColor property to your template image and displays the results in your complication. If you do not specify a value for the tintColor property, the image provider uses the tint color associated with the underlying template, or white if no other color is specified. In monochrome environments, ClockKit applies the tint color associated with the clock face itself, ignoring any custom colors you specify.

In addition to the one-piece image, you may optionally specify two additional images to composite together to create a single final image. Two-piece images are displayed only in multicolor environments and take priority over one-piece images in those environments. A two-piece image consists of a foreground image layered on top of a background image. Both images are template images. ClockKit applies the color in the tintColor property to the background image, falling back to the color in the underlying template or white if no custom color is specified. ClockKit always applies a white color to the foreground image. Two-piece images are not used in monochrome environments.

For information about the image sizes to use in different templates, see Apple Watch Human Interface Guidelines.

Topics

Creating an Image Provider

init(onePieceImage: UIImage)

Creates and returns an image provider with the specified one-piece image.

init(onePieceImage: UIImage, twoPieceImageBackground: UIImage?, twoPieceImageForeground: UIImage?)

Creates and returns an image provider with both one-piece and two-piece images.

Getting the Image Data

var onePieceImage: UIImage

The template image to use as a one-piece image.

var tintColor: UIColor?

The tint color to apply to the image in a multicolor clock face.

var twoPieceImageBackground: UIImage?

The background image in a two-piece image.

var twoPieceImageForeground: UIImage?

The foreground image in a two-piece image.

Setting the Accessibility Label

var accessibilityLabel: String?

A succinct label that succinctly identifies the purpose of the image.

Relationships

Inherits From

See Also

Data Providers

class CLKDateTextProvider

A formatted string that conveys a date without any time information.

class CLKRelativeDateTextProvider

A formatted string that conveys the difference in time between the current date and a date that you specify.

class CLKSimpleTextProvider

A single line of text to display in your complication interface.

class CLKTextProvider

The common behavior for displaying text-based data in a complication.

class CLKTimeIntervalTextProvider

A formatted time range.

class CLKTimeTextProvider

A formatted time value.