Adding a widget to your Home Screen
So far, you've been testing your widget using the LetsEatWidgetExtension scheme. You'll now use the LetsEat scheme and see how to add widgets to the Home Screen. Follow these steps:
- Select the LetsEat scheme and iPhone SE (2nd generation) from the Scheme menu:
Figure 24.8 – Scheme menu with LetsEat and iPhone SE selected
- Build and run your app. Choose Home from the Device menu.
- Tap and hold any app icon on the simulator's screen and choose Edit Home Screen from the pop-up menu. All the icons will start jiggling.
- Tap the + button to display the widget picker screen:
Figure 24.9 – iOS simulator showing the + button
- Choose the LetsEat widget from the widget picker screen:
Figure 24.10 – iOS simulator showing the widget picker screen
- Choose a widget size and tap Add Widget:
Figure 24.11 – iOS simulator showing the widget size screen
- Position the widget anywhere you like and choose...