ios17 widget display area problem

I am having trouble displaying widgets on iOS17. In iOS16, it can be displayed in the full size of the widget, but in iOS17, it is displayed in an area 16 dots smaller in all direction than the original size. I would like to have the same display on iOS17 as on iOS16, is there a better way?

struct widgetSmall : View {
    var body: some View {
        ZStack() {
            Rectangle()
                .foregroundColor(Color.yellow)
            VStack() {
                HStack() {
                    Text("Upper-left")
                    Spacer()
                }
                Spacer()
                HStack() {
                    Spacer()
                    Text("Lower-right")
                }
            }
        }
    }
}

Answered by ikedamasahiro in 765662022

Self resolved. In iOS17, the widget specifications has been changed and I have to use ".contentmarginsdisabled()"

https://developer.apple.com/documentation/swiftui/widgetconfiguration/contentmarginsdisabled()

Accepted Answer

Self resolved. In iOS17, the widget specifications has been changed and I have to use ".contentmarginsdisabled()"

https://developer.apple.com/documentation/swiftui/widgetconfiguration/contentmarginsdisabled()

ios17 widget display area problem
 
 
Q