A protocol that communicates with ClockKit, providing information about your complication.
- watchOS 2.0+
Apps that support a complication must define a class that supports the
CLKComplication protocol and register it with the system. Your data source is responsible for providing timeline entries and data for all of the complication families that you support. You do this by implementing the protocol methods, returning the timeline entries displayed by your complication and information about the features that your complication supports.
You don’t instantiate your data source class explicitly. After defining your class, specify the class name in the General tab of the project settings for your WatchKit extension. When the system needs data, ClockKit instantiates your data source and initializes it by calling its
init method. Once initialized, ClockKit calls the corresponding protocol methods to gather any needed data. (You can also specify your class name in your app’s
Info file using the
When the user installs your complication on the clock face, ClockKit creates an appropriate
CLKComplication object for the selected complication family. That complication object is passed to your data source so that you know how to format your timeline entries. Use the General tab of your WatchKit extension’s project settings to specify the families you support.
Your complication data source class must implement the following
You may implement other methods as needed to support the data in your complication. ClockKit calls the methods of your data source on your watchOS app’s main thread.
For more information, see Providing Data for Your Complication.