Class

CLKImageProvider

An image displayed by a complication.

Declaration

class CLKImageProvider : NSObject

Overview

You create an image provider with at least one image, and you may specify two additional images to use under certain conditions. The specified images are template images, with 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, comprised of a single template image. In multicolor classic complications, 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 applies the tint color associated with the underlying template or white if the template doesn’t specify a color. In tinted graphic complications, ClockKit ignores the tintColor property, and applies the color associated with the watch face.

In addition to the one-piece image, you may optionally specify two additional images to composite together in order to create a single final image. A two-piece image consists of a foreground image layered on top of a background image. Both images are template images. For classic complications, ClockKit applies the color in the tintColor property to the background image, falling back to the color in the underlying template or white if the template doesn’t specify a color. For tinted graphic complications, the system determines the color according to the user’s color selection. In classic complications, two-piece images take priority over one-piece images. In tinted graphic complications, the system can choose either the one-piece or two-piece image, based on the complication and watch face.

For information about 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 CLKFullColorImageProvider

A full-color image displayed by a complication.

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.

class CLKSimpleGaugeProvider

A gauge that shows a fractional value.

class CLKTimeIntervalGaugeProvider

A gauge that tracks time intervals.

class CLKGaugeProvider

An abstract superclass that provides all the common behaviors for the gauge providers.

let CLKSimpleGaugeProviderFillFractionEmpty: Float

A fill value indicating an empty gauge.

enum CLKGaugeProviderStyle

Visual styles available for gauges.