I'd like to make a 2px border from a view, but the border only accepts a ShapeStyle. I'm trying to do something like:
let specialRadialGradient = GeometryReader { geometry in
RadialGradient(
gradient: Gradient(
stops: [
.init(color: Color("gradient1").opacity(0.5), location: 0),
.init(color: Color("gradient2").opacity(0.5), location: 1)
]
),
center: .init(x: 0.1432, y: 0.7254
startRadius: .zero,
endRadius: geometry.size.width * 0.75
)
.background(Color.brandPrimary)
}
Text("Abc")
.frame(maxWidth: .infinity)
.padding()
.border(specialRadialGradient, 2)
However, since the specialRadialGradient view is wrapped in a GeometryReader to handle the radial gradient properly in all ratio sizes, it doesn't compile. How can I cut out a 2px border out of specialRadialGradient and apply it to the background of the text?
