IOS14 widgets in action one
preface
Due to project requirements, a widget needs to be added to the desktop to increase retention and usage. After a week of swiftUI learning, now I would like to share with you the details of the whole requirement development, especially when I didn’t know how to start developing the Widget for the first time. Now I will teach you how to operate the Widget by hand. (Since the iOS Today Widget is outdated, I won’t cover it here; the iOS Widget is meant to replace it.)
Starting from scratch
Project creation
- Create a new project first, skip this step if it is an existing project
2. Create the Widget Target and follow the steps shown above.
Now that you’ve done all the preparatory work, run the main project MyWidgetTestProject you just created, click the emulator home button to return to the desktop, and see if a new desktop widget has been added.
Slide the emulator to the right until it is no longer possible to slide, and you will reach page 0. Follow the steps in the picture below to add various styles of widgets