objective-capple-watch-complicationclockkit

Apple Clockkit - Multiple complications for same family


As a starting point to creating complications, static data can be presented in the following way by implementing the Complications delegate example code shown below:

This structure implies that I am only able to create one complication per complication family. Is this true? Are there any other options I have here?

For example, how would I create another modular small complication in addition to the one below, of a different type, ie. CLKComplicationTemplateModularSmallStackImage so that both would show in the modular small region?

Is this possibly a user-preference that can be managed?

#pragma mark - Placeholder Templates

- (void)getPlaceholderTemplateForComplication:(CLKComplication *)complication withHandler:(void(^)(CLKComplicationTemplate * __nullable complicationTemplate))handler {
// This method will be called once per supported complication, and the results will be cached


if  (complication.family == CLKComplicationFamilyModularSmall){

    CLKComplicationTemplateModularSmallStackText *template = [[CLKComplicationTemplateModularSmallStackText alloc] init];
    //     template.headerTextProvider = [CLKSimpleTextProvider textProviderWithText:@"Title Text"];
    template.line1TextProvider = [CLKSimpleTextProvider textProviderWithText:@"TEXT1"];
    template.line2TextProvider = [CLKSimpleTextProvider textProviderWithText:@"TEXT2"];
    template.tintColor = [UIColor whiteColor];

    handler(template);


} else if (complication.family == CLKComplicationFamilyModularLarge){


    CLKComplicationTemplateModularLargeStandardBody *template = [[CLKComplicationTemplateModularLargeStandardBody alloc] init];
    template.headerTextProvider = [CLKSimpleTextProvider textProviderWithText:@"Text1"];
    template.body1TextProvider = [CLKSimpleTextProvider textProviderWithText:@"Text2"];
    template.body2TextProvider = [CLKSimpleTextProvider textProviderWithText:@"Text3"];


    UIImage *surfMain = [UIImage imageNamed:@"person"];

    template.headerImageProvider = [CLKImageProvider imageProviderWithOnePieceImage:surfMain];



    handler(template);
}

}

Solution

  • At this time, you can't offer multiple choices for a particular family. You're expected to choose the best template among the ones offered for that family.

    For your particular example, there are seven different modular small templates. Even if you limited yourself to giving the user two choices, it wouldn't scale well if every app that supported complications doubled or tripled the number of choices they offered within a particular family.

    Apple appears to have chosen a good design for both users and developers by limiting it to one complication per family. If you have a reason to support more than one, you can submit a feature request to the Apple Watch team.