如果我不支持它,我想知道如何不显示并发症系列。
示例:超大表盘
InComplicationController.swift
和方法我只是在打开Extra LargegetLocalizableSampleTemplate
时getCurrentTimelineEntry
传入 a :handler(nil)
complication.family
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()
}
}
}
}