Это код
let starPath = UIBezierPath(rect: CGRect(x: 30, y: 30, width: 50, height: 50))
starPath.move(to: CGPoint(x: 45.25, y: 0))
starPath.addLine(to: CGPoint(x: 61.13, y: 23))
starPath.addLine(to: CGPoint(x: 88.29, y: 30.75))
starPath.addLine(to: CGPoint(x: 70.95, y: 52.71))
starPath.addLine(to: CGPoint(x: 71.85, y: 80.5))
starPath.addLine(to: CGPoint(x: 45.25, y: 71.07))
starPath.addLine(to: CGPoint(x: 18.65, y: 80.05))
starPath.addLine(to: CGPoint(x: 19.55, y: 52.71))
starPath.addLine(to: CGPoint(x: 2.21, y: 30.75))
starPath.addLine(to: CGPoint(x: 29.37, y: 23))
starPath.close()
starPath.lineWidth = 1
UIColor.red.setStroke()
starPath.stroke()
let shapeLayer = CAShapeLayer()
shapeLayer.path = starPath.cgPath