I want to maintain the same inset around my custom view. Exterior corner radius is required to change the corner radius of our custom views,
I could not find any environment variable or any other way to get the corner radius of the widget itself.
- Just parsing a hardCoded value to
.cornerRadius()
is not work on every device. Since different devices may use a different radius for their widgets.
var body: some View {
VStack {
HStack {
VStack {
Text("Hello")
.font(.title)
Text("Widget")
}
.padding()
.background(Color.yellow)
.cornerRadius(10)//<=here
Spacer()
}
Spacer()
}
.padding(5.0)
}