NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills today! >>

SwiftUI view as complication

Forums > watchOS

Hi guys!

Me again and I’m wondering if there’s anyone out there who’s played with WatchKit and using SwiftUI views as complications. Going through wwdc20 vids atm but would love a tutorial or something so I can make sense of it all.

I'm closer now I think,

Ive created the descriptors for the complication view here:

func getComplicationDescriptors(handler: @escaping ([CLKComplicationDescriptor]) -> Void) {
        var descriptors : [CLKComplicationDescriptor] = []
        descriptors.append(CLKComplicationDescriptor(identifier: "ComplicationView",
                                                     displayName: "Complication View",
                                                     supportedFamilies: [.circularSmall]))
        // Call the handler with the supported complication descriptors

And now I have to create the template and I know this is wrong, but would love some pointers for some help. Thanks

func createTemplate(
        forComplication complication: CLKComplication,
        date: Date) -> CLKComplicationTemplate? {
        let defaultTemplate: (CLKComplicationFamily) -> CLKComplicationTemplate = { family -> CLKComplicationTemplate in
              // Return a default complication template for the given family
        switch (, complication.identifier) {
            case (.circularSmall, "ComplicationView"):
                return CLKComplicationTemplateGraphicCircularView(ComplicationView())

Thanks Mark


Hacking with Swift is sponsored by Essential Developer

SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until October 1st.

Click to save your free spot now

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.