I'm currently setting up complications for my watchOS 2 app.
I want to offer three different types of complications:
- Utilitarian small
- Modular smallist item
- Circular small
All these complication types should simply display my app icon as an image. In my ClockKit class, I have implemented the following method:
func getCurrentTimelineEntryForComplication(complication: CLKComplication, withHandler handler: (CLKComplicationTimelineEntry?) -> Void) {
if complication.family == .CircularSmall {
let template = CLKComplicationTemplateCircularSmallRingImage()
template.imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "app_icon")!)
let timelineEntry = CLKComplicationTimelineEntry(date: NSDate(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .UtilitarianSmall{
let template = CLKComplicationTemplateUtilitarianSmallRingImage()
template.imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "app_icon")!)
let timelineEntry = CLKComplicationTimelineEntry(date: NSDate(), complicationTemplate: template)
handler(timelineEntry)
} else if complication.family == .ModularSmall {
let template = CLKComplicationTemplateModularSmallRingImage()
template.imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "app_icon")!)
let timelineEntry = CLKComplicationTimelineEntry(date: NSDate(), complicationTemplate: template)
handler(timelineEntry)
} else {
handler(nil)
}
}
I'm not sure that's the appropriate way of realising my idea, so I'd like to know the code for just displaying an image as my complication. Does anybody know how I could achieve this?