I would like to apply a list of properties to a VStack instead of a shape. The following code is applying my list of properties to a shape through innerN function that is defined in a Shape extension:
ZStack {
Color.mph
let shape = RoundedRectangle(cornerRadius: 25)
//let shape = Circle() //it works with any shapes
shape
.innerN(Color.mph)
.frame(width: 300, height: 300)
}
extension Shape {
public func innerN<S:ShapeStyle>
(_ fillContent: S) -> some View
{
ZStack {
self.fill(fillContent)
.overlay(
self
.stroke(Color.gray, lineWidth: 4)
.blur(radius: 4)
.offset(x: 2, y: 2)
.mask(self.fill(LinearGradient(Color.black, Color.clear)))
)
.overlay(
self
.stroke(Color.white, lineWidth: 8)
.blur(radius: 4)
.offset(x: -2, y: -2)
.mask(self.fill(LinearGradient(Color.clear, Color.black)))
)
}
}
}
How can I modify my extension so I could something like? :
VStack(spacing: 20){//...}
.padding()
.cornerRadius(25)
//.innerN(color) //with the shape of that VStack