watchOS Complication Utilitarian Small
Utilitarian Small
4種類
-
CLKComplicationTemplateUtilitarianSmallFlat
CLKComplicationTemplateUtilitarianSmallRingImage
CLKComplicationTemplateUtilitarianSmallRingText
CLKComplicationTemplateUtilitarianSmallSquare
CLKComplicationTemplateUtilitarianSmallFlat
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .utilitarianSmall: let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "soccer22")!) let textProvider = CLKSimpleTextProvider(text: "Text") let utilitarianTemplate = CLKComplicationTemplateUtilitarianSmallFlat() utilitarianTemplate.imageProvider = imageProvider utilitarianTemplate.textProvider = textProvider let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: utilitarianTemplate) handler(entry) default: handler(nil) } }
CLKComplicationTemplateUtilitarianSmallRingImage
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .utilitarianSmall: let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "soccer32")!) let utilitarianTemplate = CLKComplicationTemplateUtilitarianSmallRingImage() utilitarianTemplate.imageProvider = imageProvider utilitarianTemplate.fillFraction = 0.8 utilitarianTemplate.ringStyle = .closed let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: utilitarianTemplate) handler(entry) default: handler(nil) } }
CLKComplicationTemplateUtilitarianSmallRingText
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .utilitarianSmall: let textProvider = CLKSimpleTextProvider(text: "xyz") let utilitarianTemplate = CLKComplicationTemplateUtilitarianSmallRingText() utilitarianTemplate.textProvider = textProvider utilitarianTemplate.fillFraction = 0.9 utilitarianTemplate.ringStyle = .closed let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: utilitarianTemplate) handler(entry) default: handler(nil) } }
CLKComplicationTemplateUtilitarianSmallSquare
func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) { switch complication.family { case .utilitarianSmall: let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "book50")!) let utilitarianTemplate = CLKComplicationTemplateUtilitarianSmallSquare() utilitarianTemplate.imageProvider = imageProvider let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: utilitarianTemplate) handler(entry) default: handler(nil) } }