Skip to content

Instantly share code, notes, and snippets.

@alexnikol
Created June 16, 2020 12:21
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 alexnikol/afeeb79ff3bbacf752c3231ae9f5c790 to your computer and use it in GitHub Desktop.
Save alexnikol/afeeb79ff3bbacf752c3231ae9f5c790 to your computer and use it in GitHub Desktop.
UIBezierPath-Line
//Path part
let path = UIBezierPath()
path.move(to: CGPoint(x: 200, y: 200)) //StartPoint
path.addLine(to: CGPoint(x: 380, y: 380)) //EndPoint of First Line and StartPoint for Second Line
path.addLine(to: CGPoint(x: 20, y: 380)) //EndPoint of Second Line
//Shape part
let shape = CAShapeLayer()
shape.path = path.cgPath
shape.lineWidth = 4.0
shape.fillColor = UIColor.clear.cgColor
shape.strokeColor = UIColor.orange.cgColor
view.layer.addSublayer(shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment