watchOS Complication Utilitarian Large

Utilitarian Large

Document

1種類

CLKComplicationTemplateUtilitarianLargeFlat

func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {
    switch complication.family {
    case .utilitarianLarge:
        let imageProvider = CLKImageProvider(onePieceImage: UIImage(named: "soccer22")!)
        let textProvider = CLKSimpleTextProvider(text: "Text Text Text Text Text")

        let utilitarianTemplate = CLKComplicationTemplateUtilitarianLargeFlat()
        utilitarianTemplate.imageProvider = imageProvider
        utilitarianTemplate.textProvider = textProvider
        
        let entry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: utilitarianTemplate)

        handler(entry)
    default:
        handler(nil)
    }
}

Swift

Posted by shi-n