SwiftUI : Is there a way to force a Shape (a View of type "Shape") to rotate with the phone (as opposed to rotate automatically) so that it keeps its original orientation with respect to the screen of the phone?
// Symbol House
struct House: Shape {
let dx: CGFloat
let dy: CGFloat
func path(in r: CGRect) -> Path {
var path = Path()
var p0 = point(in: r, from: CGPoint(x: r.minX, y: r.minY))
p0 = shift(p: p0, dx: dx, dy: dy)
var p1 = point(in: r, from: CGPoint(x: r.minX, y: r.maxY/2))
p1 = shift(p: p1, dx: dx, dy: dy)
var p2 = point(in: r, from: CGPoint(x: r.maxX/2 , y: r.maxY))
p2 = shift(p: p2, dx: dx, dy: dy)
var p3 = point(in: r, from: CGPoint(x: r.maxX, y: r.maxY/2))
p3 = shift(p: p3, dx: dx, dy: dy)
var p4 = point(in: r, from: CGPoint(x: r.maxX, y: r.minY))
p4 = shift(p: p4, dx: dx, dy: dy)
path.move(to: p0)
path.addLine(to: p1)
path.addLine(to: p2)
path.addLine(to: p3)
path.addLine(to: p4)
path.addLine(to: p0)
return path
}
}
