Skip to content

Instantly share code, notes, and snippets.

@alsedi
Created September 1, 2016 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alsedi/a74595d48d708735c52abd917d9c7e09 to your computer and use it in GitHub Desktop.
Save alsedi/a74595d48d708735c52abd917d9c7e09 to your computer and use it in GitHub Desktop.
private var rectanglePath: CGPath {
let width = frame.size.width
let height = frame.size.height
let myPath = UIBezierPath()
myPath.lineCapStyle = CGLineCap.butt
myPath.lineJoinStyle = CGLineJoin.miter
myPath.move(to: CGPoint.zero)
myPath.addQuadCurve(to: CGPoint(x:width,y:0), controlPoint:CGPoint(x:width/2.0,y:0))
myPath.addQuadCurve(to: CGPoint(x:width,y:height), controlPoint:CGPoint(x:width,y:height/2.0))
myPath.addQuadCurve(to: CGPoint(x:0,y:frame.size.height), controlPoint:CGPoint(x:width/2.0,y:height))
myPath.addQuadCurve(to: CGPoint.zero, controlPoint:CGPoint(x:0,y:height/2.0))
myPath.close()
return myPath.cgPath
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment