Skip to content

Instantly share code, notes, and snippets.

@DanielCardonaRojas
Created December 19, 2017 04:38
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 DanielCardonaRojas/432226f37bfb94416a8fc0321267a091 to your computer and use it in GitHub Desktop.
Save DanielCardonaRojas/432226f37bfb94416a8fc0321267a091 to your computer and use it in GitHub Desktop.
class BezierView: UIView {
private var bezier: UIBezierPath
init(bezier: UIBezierPath) {
self.bezier = bezier
let transform = CGAffineTransform()
transform.scaledBy(x: 2, y: 2)
let rectBounds = bezier.bounds
rectBounds.applying(transform)
super.init(frame:rectBounds)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func draw(_ rect: CGRect) {
// Drawing code
bezier.lineCapStyle = .round
bezier.lineWidth = 10
bezier.stroke()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment