【发布时间】:2020-12-20 00:07:54
【问题描述】:
如果我不支持,我想知道如何不显示并发症族。
示例:超大表盘
在ComplicationController.swift 的getLocalizableSampleTemplate 和getCurrentTimelineEntry 方法中,当为超大号打开complication.family 时,我只需传入handler(nil):
case .extraLarge:
handler(nil)
但这一定不是对的,也不一定是这样,因为我的特大号并发症仍然可以选择:
但它显然不起作用或有任何数据可显示:
有人知道我错过了什么吗?谢谢!
更新:
我的ComplicationController.swift 的getComplicationDescriptors:
func getComplicationDescriptors(handler: @escaping ([CLKComplicationDescriptor]) -> Void) {
let oneSupported = [
CLKComplicationFamily.circularSmall,
.modularSmall,
.utilitarianSmall,
.modularLarge,
.utilitarianLarge,
.graphicExtraLarge,
.graphicCircular
]
let twoSupported = [
CLKComplicationFamily.circularSmall,
.modularSmall,
.utilitarianSmall,
.utilitarianSmallFlat,
.extraLarge,
.graphicBezel,
.graphicCircular,
.graphicCorner,
.graphicRectangular,
.modularLarge,
.utilitarianLarge
]
let descriptors = [
CLKComplicationDescriptor(identifier: ComplicationIdentifier.height.rawValue, displayName: "Complication 1", supportedFamilies: oneSupported)
// Multiple complication support can be added here with more descriptors
,
CLKComplicationDescriptor(identifier: ComplicationIdentifier.price.rawValue, displayName: "Complication 2", supportedFamilies: twoSupported)
]
// Call the handler with the currently supported complication descriptors
handler(descriptors)
}
还有我的WatchApp.swift,它正在使用 SwiftUI 生命周期(除非我弄错了):
struct BlockWatchApp: App {
@WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extensionDelegate
var body: some Scene {
WindowGroup {
NavigationView {
WatchView()
}
}
}
}
【问题讨论】:
标签: watchkit apple-watch watchos apple-watch-complication clockkit