Widgets are extensions of existing iOS applications, and there are many uses for them in modern app development. In this video, see the possibilities and limitations of implementing widgets in iOS.
- [Instructor] So, what are widgets and what do they do? Here's an example of a very simple widget. Remember that you can access widgets either through the lock screen, if you allow it, or the search screen when your phone is unlocked. By pressing the edit button you can control which widgets show. So, here as an example I'm showing the plain old Notes widget as the only active widget on the device. Widgets can also display in an expanded or a collapsed view.
So, let's go into more specifically what they can do and what they're supposed to be used for. The purpose of a widget is to enable a user to perform simple tasks outside of an app. They should be quickly accessible from the search or the lock screen, provided the user allows it, and with a paid developer program membership, a widget can share data with your full application. So, your app can save data, your widget can see that saved data and the widget can actually save data itself.
If you think of the Reminders app, it's built into your phone, you can actually check off reminders from the widget and that works just like if you were checking off the reminder inside of the full application because the widget and the app share data. So again, this is a feature that you must be registered and a paid developer to be able to access. Widgets allow simple user interaction, just like I mentioned with the Reminders app. Ideally, Apple recommends that it takes one tap to perform a task.
So, now let's look at the limitations that you have when you're working with widgets. You don't have keyboard entry at all. Scroll views and multi-step actions are discouraged, so if you use them Apple might reject your application. There are several other things that are discouraged and for more information I'd refer you to Apple's Human Interface Guidelines document and you can see the link here on your screen. So, basically widgets are many versions of your application that allow you to perform simple tasks.
- Understanding the possibilities and limitations of widgets
- Adding a Today extension
- Adjusting widget size
- Connecting UI elements to code
- Creating an app group for sharing data
- Creating custom app URLs
- Sending and receiving URL parameters
- Parsing URL parameters
- Handling URLs
- Going to a specific screen from a widget