Build iOS Widget
Let’s start by building our simple App. Open up Xcode and create a new iOS App Project; make sure SwiftUI is selected in the Interface options and SwiftUI App is selected in the Life Cycle options.
And then create a new target. File -> New -> Target. In the searchText input Widget
, select Widget Extension
and go to Next. Then will got a Activate “MainWidgetExtension” scheme?
, select Activate.
createApp | create Target | |
---|---|---|
- | ||
- |
In the Left Bar we can see the Widget Target Code, and we can see the widget’s preview. Just change the body code, can update the Widget View.