0
我用複雜功能製作了Apple Watch應用程序,並激活了模塊化小型應用程序。我將以下代碼添加到ComplicationController.swift中,但我只能看到一個方形圖標。試圖把文字或圖像放在裏面什麼都不做。
預先感謝您的幫助!
Apple Watch Complication圖標或文字
func getPlaceholderTemplate(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTemplate?) -> Void) {
var template: CLKComplicationTemplate?
switch complication.family {
case .modularSmall:
template = CLKComplicationTemplateModularSmallSimpleText()
(template as! CLKComplicationTemplateModularSmallSimpleText).textProvider = CLKSimpleTextProvider(text: "R")
default:
template = nil
}
handler(template)
}