Build Widgets for the Smart Stack on Apple Watch


Another Code along session, using AppIntents, WidgetKit and App Intents.  Check out the code which is available at in the Session 10029 folder – https://developer.apple.com/documentation/watchOS-Apps/updating-your-app-and-widgets-for-watchos-10 

Widget Configuration

  • AppIntentConfiguration is new in WatchOS 10 and will be used in this project.
  • Make sure you check out last years Dive in to App Intents to get started and then review Explore enhancements to App Intents

Timeline Setup

  • This holds all the data needs to render a widget on a particular date

Widget Views

  • There was significant work on making a nice looking Widget, but for some reason I could not get the previews to show it.  It kept crashing, and then it said there was no preview defined.  Oh well, I can see it in the simulator

Timeline

  • Make sure you enter based on date and future date, so that your fill the timeline with relevant data
  • Also, setup a AppIntentRecommendation 

Relevance (this will prioritize when our widget should be prioritized on the Smart Stack)

  • Updating the relevance information at the right time in your app is key.  This session does a great job of explaining the why of each update in the code.