Search code examples
swiftwatchkitapple-watchwatchos-3apple-watch-complication

How to set image with text in modular large complication?


I want to design modular large complication for watch app. In my complication view, I want to the user both image & text.

I have some of the design related question, which is as below:

  1. How can I set image & text both in multiple rows of complication view?
  2. Maximum how many lines modular large complication can support for display purpose?
  3. How can I create multiple complications for the same family like for Circular small complication type having Ring, Simple & Stack for a single application?

I already check module large complication apple document, but I am not getting enough information. Apple Doc:- Modular large complication


Solution

  • How can I set image & text both in multiple rows of complication view?

    You are looking to the wrong type of complications actually, you need to check the CLKComplicationTemplateModularLargeColumns.

    You can use the below code to get idea how to create it:

    func createTemplateForModularLarge() -> CLKComplicationTemplate {
            let template = CLKComplicationTemplateModularLargeColumns()
            template.row1ImageProvider = CLKImageProvider(onePieceImage: #imageLiteral(resourceName: ""))
            template.row2ImageProvider = CLKImageProvider(onePieceImage: #imageLiteral(resourceName: ""))
            template.row3ImageProvider = CLKImageProvider(onePieceImage: #imageLiteral(resourceName: ""))
            template.row1Column1TextProvider = CLKSimpleTextProvider(text: "")
            template.row2Column1TextProvider = CLKSimpleTextProvider(text: "")
            template.row3Column1TextProvider = CLKSimpleTextProvider(text: "")
            return template
        }
    

    Maximum how many lines modular large complication can support for display purpose?

    You can max use 3 rows for the CLKComplicationTemplateModularLargeColumns type.

    How can I create multiple complications for the same family like for Circular small complication type having Ring, Simple & Stack for a single application?

    Seems you can't create more then one type for the same family for single applications.