WatchOS5 - how to refresh my complication instantly?











up vote
0
down vote

favorite












I have an apple watch complication and the iPhone app running side by side. I have a button within the app to transmit application context dictionary to the watch. I expect to see the complication title to be refreshed.



I cannot seem to force the "tap button -> see update on the complication" kind of behavior.



What is the appropriate method to force a complication update? How can I refresh my apple watch complication instantly?



I do see the title changes, but I think it requires me to tap on the complication to open it's apple watch app first. How can I get the complication to update itself on the Watch home screen?



func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {

if complication.family == .graphicRectangular {
let template = CLKComplicationTemplateGraphicRectangularLargeImage()
//...configure
return template
}
}


I see this apple provided code that refreshes the complication. I'm not sure if it is too much, or if calling extendTimeline alone is sufficient if I'm generating the complication using the entry above.



func refreshComplication() {
#if os(watchOS)
let server = CLKComplicationServer.sharedInstance()
if let complications = server.activeComplications {
for complication in complications {
// Call this method sparingly. If your existing complication data is still valid,
// consider calling the extendTimeline(for:) method instead.
server.reloadTimeline(for: complication)
}
}
#endif
}









share|improve this question


























    up vote
    0
    down vote

    favorite












    I have an apple watch complication and the iPhone app running side by side. I have a button within the app to transmit application context dictionary to the watch. I expect to see the complication title to be refreshed.



    I cannot seem to force the "tap button -> see update on the complication" kind of behavior.



    What is the appropriate method to force a complication update? How can I refresh my apple watch complication instantly?



    I do see the title changes, but I think it requires me to tap on the complication to open it's apple watch app first. How can I get the complication to update itself on the Watch home screen?



    func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {

    if complication.family == .graphicRectangular {
    let template = CLKComplicationTemplateGraphicRectangularLargeImage()
    //...configure
    return template
    }
    }


    I see this apple provided code that refreshes the complication. I'm not sure if it is too much, or if calling extendTimeline alone is sufficient if I'm generating the complication using the entry above.



    func refreshComplication() {
    #if os(watchOS)
    let server = CLKComplicationServer.sharedInstance()
    if let complications = server.activeComplications {
    for complication in complications {
    // Call this method sparingly. If your existing complication data is still valid,
    // consider calling the extendTimeline(for:) method instead.
    server.reloadTimeline(for: complication)
    }
    }
    #endif
    }









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have an apple watch complication and the iPhone app running side by side. I have a button within the app to transmit application context dictionary to the watch. I expect to see the complication title to be refreshed.



      I cannot seem to force the "tap button -> see update on the complication" kind of behavior.



      What is the appropriate method to force a complication update? How can I refresh my apple watch complication instantly?



      I do see the title changes, but I think it requires me to tap on the complication to open it's apple watch app first. How can I get the complication to update itself on the Watch home screen?



      func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {

      if complication.family == .graphicRectangular {
      let template = CLKComplicationTemplateGraphicRectangularLargeImage()
      //...configure
      return template
      }
      }


      I see this apple provided code that refreshes the complication. I'm not sure if it is too much, or if calling extendTimeline alone is sufficient if I'm generating the complication using the entry above.



      func refreshComplication() {
      #if os(watchOS)
      let server = CLKComplicationServer.sharedInstance()
      if let complications = server.activeComplications {
      for complication in complications {
      // Call this method sparingly. If your existing complication data is still valid,
      // consider calling the extendTimeline(for:) method instead.
      server.reloadTimeline(for: complication)
      }
      }
      #endif
      }









      share|improve this question













      I have an apple watch complication and the iPhone app running side by side. I have a button within the app to transmit application context dictionary to the watch. I expect to see the complication title to be refreshed.



      I cannot seem to force the "tap button -> see update on the complication" kind of behavior.



      What is the appropriate method to force a complication update? How can I refresh my apple watch complication instantly?



      I do see the title changes, but I think it requires me to tap on the complication to open it's apple watch app first. How can I get the complication to update itself on the Watch home screen?



      func getCurrentTimelineEntry(for complication: CLKComplication, withHandler handler: @escaping (CLKComplicationTimelineEntry?) -> Void) {

      if complication.family == .graphicRectangular {
      let template = CLKComplicationTemplateGraphicRectangularLargeImage()
      //...configure
      return template
      }
      }


      I see this apple provided code that refreshes the complication. I'm not sure if it is too much, or if calling extendTimeline alone is sufficient if I'm generating the complication using the entry above.



      func refreshComplication() {
      #if os(watchOS)
      let server = CLKComplicationServer.sharedInstance()
      if let complications = server.activeComplications {
      for complication in complications {
      // Call this method sparingly. If your existing complication data is still valid,
      // consider calling the extendTimeline(for:) method instead.
      server.reloadTimeline(for: complication)
      }
      }
      #endif
      }






      ios12 apple-watch-complication watch-os-5






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 18 at 20:00









      Alex Stone

      19.3k44179328




      19.3k44179328





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364888%2fwatchos5-how-to-refresh-my-complication-instantly%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53364888%2fwatchos5-how-to-refresh-my-complication-instantly%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin