From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Custom widgets with intents, part 2

Custom widgets with intents, part 2

From the course: iOS Development Tips

Custom widgets with intents, part 2

- [Instructor] Last week, we got the switch on the widget, but now what are we going to do with it? This time, let's get that switch to turn off the photo and replace it with an SF symbol. There's two strategies I can take here; pass the configuration to the views or handle the configuration before I get to the views. I'm going to look at both, but start with the configuration way. I'll pass the configuration around in SimpleEntry. First of all, and we're going to go over here to SimpleEntry, and that's our timeline entry. I'm going to put in var configuration, and then I'm going to put in a configuration intent. I'm going to make that optional and make it nil. If I don't have one, I can actually default it to nil, and that'll help us with a couple cases as we continue up through this. Because all of our timeline entries are going to have the configuration data. Configuration is by the widget and not for all widgets, so…

Contents