49. Supporting WidgetKit Size Families
In the chapter titled “Building Widgets with SwiftUI and WidgetKit”, we learned that a widget is able to appear in small, medium and large sizes. The project created in the previous chapter included a widget view designed to fit within the small size format. Since the widget did not specify the supported sizes, it would still be possible to select a large or medium sized widget from the gallery and place it on the home screen. In those larger formats, however, the widget content would have filled only a fraction of the available widget space. If larger widget sizes are to be supported, the widget should be designed to make full use of the available space.
In this chapter, the WidgetDemo project created in the previous chapter will be modified to add support for the medium widget size.