Complication help please...

Xcode 7.3, watchOS2, simulator Watch, Version 2.2 (SimulatorApp-645.9


1. I have a simple modularLargeTemplate complication. In simulator, I see the text in the customize screen but on the face it shows all dashes! why???

- also the modularSmallTemplate image shows as a blue box? it shows image properly in customize. Image is correct also Alpha channel only!

very frustrating this behavior, bugs??? see same thing on my watch!!!


2. Question: can I set the color of body2TextProvider ??

3. Question: How can I set, body2TextProviderm to be Italic? like apple does in there calendar modularLargeTemplate for location???

     case .ModularLarge:
            let modularLargeTemplate = CLKComplicationTemplateModularLargeStandardBody()
            let headerTextTime = "3 PM-4:15"
      
            let timeUntil = "in 1hr, 36 min"
            let headerText = headerTextTime
            let body1Text = "Meeting with Clients"
            let body2Text =  "             " + timeUntil

            modularLargeTemplate.headerTextProvider = CLKSimpleTextProvider(text: headerText)
            modularLargeTemplate.body1TextProvider = CLKSimpleTextProvider(text: body1Text)
            modularLargeTemplate.body2TextProvider = CLKSimpleTextProvider(text: body2Text)
      
            modularLargeTemplate.tintColor = UIColor.yellowColor()
      
            print("w91 headerText: \(headerText)")
            print("w92 body1Text: \(body1Text)")
            print("w93 body2Text: \(body2Text)")
            template = modularLargeTemplate
            handler(modularLargeTemplate)


thank you for your help and guidance so I can onward again...

Sincerely, Mike


#1: It shows dashes when it doesn't have real or placeholder data yet; those are the cases where you get the Complication Asset images for the other variants, but AFAICT there's no place to set an equivalent friendlier large complication default. I'll probably request that in Radar; the dashes annoy me.

Customize uses the getPlaceholderTemplateForComplication. Are you returning the same thing for that and the real ones? Is your image marked as being a template image? There's a "Render as" popup in the IB inspector.

- ETA: it only shows the placeholder in the customize screen. If you have data, then you're missing something that tells the watch to show it. But if it really is a case of no data, then to get rid of the dashes, you need to return a start/end date for that complication - I used the earliest/latestTimeTravelDates because I don't want it to ever gray out - and have getCurrentTimelineEntryForComplication return something useful. The before/after callbacks can return nil. You could reuse the placeholder text if it's applicable, but mine lets the user know they haven't chosen anything on the iPhone side; the placeholder text is supposed to be a representative sample of the real content.


#2: modularLargeTemplate.body2TextProvider.tintColor, inherited from the superclass, but it's at the discretion of the watch face whether it's applied or not, and colors don't work in the Simulator at all.


#3: I haven't seen any italics in complications, but Apple has been known to use internal APIs. Sometimes they'll make them public; file a Radar requesting it.


Also you should be using CLKRelativeDateTextProvider for your relative dates and CLKDateTextProvider for your fixed dates. For a range like you show there, use a combination text provider (found that on the WWDC session, which is full of cool useful stuff):


CLKDateTextProvider *start =

[CLKDateTextProvider textProviderWithDate:startDate units:NSCalendarUnitHour | NSCalendarUnitMinute];

CLKDateTextProvider *end =

[CLKDateTextProvider textProviderWithDate:endDate units:NSCalendarUnitHour | NSCalendarUnitMinute];

return [CLKTextProvider textProviderWithFormat:@"%@ %@", start, end];

Thank you Lee Ann.


"Customize uses the getPlaceholderTemplateForComplication. Are you returning the same thing for that and the real ones?"

- I do not know or understand this. I am kinda new! 🙂


"Is your image marked as being a template image? There's a "Render as" popup in the IB inspector."

- I did have name wrong I forgot -58px was part of name! I looked and looked do not see Render as! sorry.. we can email or chat offboard if easier. my email is: mikeswift50@gnail.com
🙂


ETA: yes I was first trying to do static text to set the font size, color, style, not sure we can do that, so I try to get it best look, then will somehow have to pull the time travel events by date time, etc... so I tried baby step first!


#2: ok on simulator! Apple!!! template is black background, modular. so I hope we can set a tint(color) would be nice. I have it looking GREAT as a GLANCE!!!! wish could do same in complication!


#3: see Modular Template, then Apple's Calendar App. then have a location! it is in Italics. I hope Apple will allow us developers to use that they obviously have programmed in already!!!! I am not on beta xCode note! (Xcode 7.3, watchOS2, simulator Watch, Version 2.2 (SimulatorApp-645.9)


Is that C? I onluy know swift 🙂 but yes will need dates after get it looking best we can, mayeb you can advise/help me then be much apprecaited.


thank you so much for your reply. I was about to ask Apple Tech Support, I have 1 more to use by Aug. 1. lol 🙂


look forward to your reply Lee Ann, 🙂 Mike.

I found set as template Image. But still see a blue box! I see icon properly in customize screen. hummmm


thx Mike

Accepted Answer

Ah, did you mean gmail there?


> "Customize uses the getPlaceholderTemplateForComplication. Are you returning the same thing for that and the real ones?"


There's three modes you need to deal with:


  • Customize: it'll show whatever content you return from getPlaceholderTemplateForComplication : "The contents of the placeholder are not updated and are meant to convey the type of data your complication displays. They do not need to convey actual user data."
  • Normal: getCurrentTimelineEntryForComplication and getTimelineEntriesForComplication(... before/after...)
  • No data yet: If you have the kind of complication where the data might not be ready at launch, you can just return "nil" to the callbacks asking for a TimelineEntry. If you have a Complication asset in your catalog, it'll use the images there for everything but ModularLarge - that one gets dashes instead.

So make sure that you've implemented getPlaceholderTemplateForComplication and it returns the same images as the Timeline versions.


Don't try to override the WatchOS's idea of the "best look". Let it do the fonts and styles. It's really good at that - there are things I wish I could have on the macOS side, though macOS is no slouch either. If you let the OS do as much work as possible, you don't need to rewrite when Apple goes through a major style revision and your app will match users expectations.


It's ObjectiveC. Everything up to the first colon maps to the Swift function name, the parts after that are the things inside Swift parens. So [self getFoo:f forX:x] becomes something like self.getFoo(f, forX:x)

Hello Lee Ann:


Thank you! yes today I figured our the 3 modes! lol. I was doing all in the customize! I have it working in After... with hard coded array. Next is to tie into my Calendar events and dates there. 🙂


I still can not get the:


case .ModularSmall:

let modularSmallTemplate = CLKComplicationTemplateModularSmallSimpleImage()

modularSmallTemplate.imageProvider = CLKImageProvider(onePieceImage: imageDMic)

template = modularSmallTemplate

handler(template)


to show the image! Image is set as Template also. seen in Customize, but then a white box when exit!

can we direct email adn maybe I can send you and see.


2. Watch Complication is VERY limited compared to the great look glace I made!

that said, I read we can color .tint a text line in watch complication, but not sure how or what I try does not show in color.

Would also be nice to do as Italics as Apple does, but at least color/tint! as we are supposecd to be able to do?


I am about to send last of 2 free tech support tickets to Apple, as it expires in 2 days unless we can solve it.


thank you so much, Mike appreciate your helps and feedback. 🙂

Hi again Lee Ann and all:


I have the Time Travel working ok. With this last problem.


I have an Event say from 7-7:10 pm... then next Event at 8 pm. So, like apple's calendar, at 7:10, the end time of event, I desire to have displayed the Next Event, and then display the delta time until it starts. I can across this which helped me with the delta until event start time.


template.body2TextProvider = CLKRelativeDateTextProvider(date: startDate,

style: .Offset,

units: NSCalendarUnit.Hour.union(.Minute))


understand my problem? Now the time travel changes to next event at time = 8 pm. Do I need to call some update Complication? I see nothing on end time of events for complication time travel at all.


thank you so much. I greatly apprecaite the help folks.


Sincerely, Mike Derr (learning swift, kind of a beginner)

If I'm understanding you right, you want your 8PM event to start showing at 7:10, with a relative date showing. This is one of the scenarios covered in the WWDC sessions - you've got the textProvider set up correctly, but the next step is for your CLKComplicationTimelineEntry to use 7:10 instead of 8. The trick to remember is that you aren't really making an entry for a time range, you're making entries with a start point, and that's followed by either another entry with a new start point or getTimelineEndDate to indicate the final entry is done. So you could even have two entries for the 8PM event - one that starts at 7:10 and shows relative time, one at 8PM on that shows absolute time.

Complication help please...
 
 
Q