Getting Started With Widgets |

In this tutorial, you’ll add a widget to a large SwiftUI app, reusing its views to show entries from the app’s repository.

This is a companion discussion topic for the original entry at

It is only for members right? Because I downloaded and obviously when I login in the simulator it says, I need to be a member :slight_smile: It was not clear from the tutorial, I thought I just did not need to be a professional subscriber. It makes sense I guess otherwise I would have access to all your videos. I might subscribe one day :+1:
I did not know your app is open source. All in SwiftUI and Combine. Impressive!

1 Like

ah, of course, the app streams the video courses! sorry! you don’t need to have a professional subscription, but I guess you do need the standard subscription. I’ll ask the gatekeeper if we can do anything.

1 Like

hi Laurent! Thanks for your patience — I’ve replaced the projects with a version that allows non-subscribers to fetch the list of tutorials. And I’ve added a note at the top about non-subscribers. Thanks for the heads up!


Thanks for making this tutorial! I really liked how it shows how to use data across targets with App Groups so the data can be shared. :+1:

One issue I had at the end is it has errors saying “Cannot find type ‘TimelineIntervalIntent’ in scope”. It builds successfully though and lets the widget be configured. :man_shrugging: (Also the final project does the same thing).

thanks Justin! it seems to be a beta 2 bug. I pulled beta 1 out of the trash and the project builds there without that warning. Hopefully Apple will fix it before GM.

For anyone else getting a bunch of non-specific build errors after adding the Widget target, I was able to solve it by just cleaning the build folder and re-building.

Product → Clean Build Folder, then build.

Continuing on, there appear to be a few changes to the Starter Code not represented on the tutorial page.


public typealias Entry = SimpleEntry

has been replaced with:

let entry = SimpleEntry

“public typealias entry” does not appear in the starter code project.



has been replaced with:


General feedback:


First, delete EmitronWidgetEntryView. You’ll use your EntryView instead.

Should specify that you’re deleting the EmitronWidgetEntryView within var body: some WidgetConfigruation . When I first read that instruction I was baffled as to why I would be deleting the struct I had just updated during the previous step.

2. I may be doing something wrong, but “PlaceholderView” doesn’t appear in my project. Given where it is in the Final project, I’m guessing it’s now auto-generated with the title EmitronWidgetEntryView.

3. The StaticConfig init you’re using is already deprecated :(

thanks for flagging these Xcode beta updates, Sean!

sorry about the confusion over EmitronWidgetEntryView — that instruction is in the middle of editing EmitronWidget.swift and the two structs have different names, so we didn’t think it needed more specification.

Settings does not work with me with message unable to load, I spent a day try to find out what wrong, and then I noticed this ( Make sure its target is both emitron and EmitronWidgetExtension ) :disappointed_relieved:

Thank you for tut! Having build failures building the initial starter app. Project > package loading error > first failure is “Failed to recurse into submodule path 'Tests/Performace/Realm”. Then 5 issues on emitron target (“Package resolution errors must be fixed before building”).

In Swift Package Dependencies it looks like all the packages download ok. I’ve tried all the usual cleaning rituals:

  • deleting derived data
  • cleaning build folder
  • reset package caches
  • update to latest package versions

I’m on Xcode 12.2. beta. Any ideas appreciated. Thx!

hi Tarek! apologies, that was a late discovery for us too. I’ll add a screenshot to make it more obvious. There’s also another instruction on Apple’s documentation page that I’ll add, although it didn’t seem to make any difference.

When did you last run this project? and which version of Xcode are you using? Because now I’m getting the same build failures as superredviking :confounded:

hi superredviking! I updated the code to 12.2 beta just a week ago and it worked fine. But now it’s failing the same as yours. Even in Xcode 12.0. I’ve emailed the error log to the emitron developer but it’s midnight where he is. Looking at the errors, it might be something in the 3rd party packages :anguished:

amazing … Xcode 12.0.1 installed itself last night, but not in my Applications folder. It’s in the App Store. The project builds fine now. :relieved:

Cannot make the Intent working on my own project. I have widgets showing data from one out of 3 accounts. I wanna allow user to pick account 1, 2 or 3 like you do with timeInterval but it does not work for me.

So I tried exactly your way to see if I could play with time interval refresh but even this does not work on my project.

Anywhere to redirect? There’s not much out on these widgets yet.

Your tutorial helped tremendously other than the intent. Looking forward to have this fixed or revised.

hi Florent! did you see the instruction about setting the target as both the app and the widget?

select SiriKit Intent Definition File and name it TimelineInterval . Make sure its target is both emitron and EmitronWidgetExtension .

it’s non-intuitive but mine wouldn’t work until I added the app target

Wow thanks for your quick reply! It was set properly.

I ended going there: Widgets Code-along, part 1: The adventure begins - WWDC20 - Videos - Apple Developer
and it helped (a bit). It shows that your implementation is perfect. No worries!

I then searched a bit more (I hate when this is the fix) I needed to restart xCode for it to finally find my AccountSelectionIntent (it might be worth a note in the tutorial) CharacterSelectionIntent not avail… | Apple Developer Forums

Thanks Audrey for this great tutorial and more importantly your reactiveness.

hi Florent! great that you found a fix! Unfortunately it’s something we all get used to, having to restart Xcode or even the Mac. Also Product Clean and delete DerivedData.

This tutorial has been great in learning to integrate widgets into an existing codebase. Everything has worked great but I have come across just a few problems in the final step. I’m using Xcode 12.3.

I am still encountering the “Cannot find type ‘TimelineIntervalIntent’ in scope” error, but this time I cannot build the project at all, as it’s now along with a number of other errors that have been introduced at this step.

  1. “Type ‘Provider’ does not conform to protocol ‘IntentTimelineProvider’”
  2. “Cannot find type ‘TimelineIntervalIntent’ in scope”
  3. “Cannot convert value of type ‘WidgetContent’ to expected argument type ‘Timeline’”
  4. “Reference to invalid associated type ‘Entry’ of type ‘Provider’”
  5. “Cannot find ‘configuration’ in scope”
  6. “Initializer ‘init(kind:intent:provider:content:)’ requires the types ‘TimelineIntervalIntent’ and ‘Provider.Intent’ be equivalent”
  7. “Cannot find type ‘TimelineIntervalIntent’ in scope”
  8. “Cannot convert value of type ‘(WidgetContent) → EntryView’ to expected argument type ‘(Provider.Entry) → EntryView’”

The app does not build and therefore I cannot see the user configuration in action, which is really annoying :sweat:

The only other thing I have encountered was that when adding to ContentRepository.swift in the “Writing the Contents File” step, the breakpoint was never being hit yet the app still built and the widget was working as intended.

Any advice would be greatly appreciated.

hi, I’ve just downloaded the app, uncommented the intent code and run it in a simulator. Everything builds and runs OK. (Xcode 12.3 on Catalina).

Make sure you set the target to both emitron and EmitronWidgetExtension.

I found another tutorial that says: Go to Project Targets, add your intent under Supported Intents. Try this? I didn’t need it to run the app.

Also try restarting your Mac