I'm wondering how to not show a Complication Family if I'm not supporting it.
Example: Extra Large watch face
In ComplicationController.swift
's getLocalizableSampleTemplate
and getCurrentTimelineEntry
methods I just pass in a handler(nil)
when switching on complication.family
for Extra Large:
case .extraLarge:
handler(nil)
But that must not be right or all there is to do, because my complication for Extra Large is still able to be chosen:
But it obviously doesn't work or have any data to show:
Does anyone know what I'm missing? Thanks!
UPDATE:
My ComplicationController.swift
's 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)
}
Also here's my WatchApp.swift
which is using that SwiftUI lifecycle (unless I'm mistaken):
struct BlockWatchApp: App {
@WKExtensionDelegateAdaptor(ExtensionDelegate.self) var extensionDelegate
var body: some Scene {
WindowGroup {
NavigationView {
WatchView()
}
}
}
}