swiftcgpathnsbezierpath

How to use bezierPathWithCGPath Swift


I need to make a bezier path, I have the CGPath the only information I found was this:

Declaration
SWIFT

convenience init(CGPath CGPath: CGPath)

the first is written normal, the second in Italics and the third purple in the developers library

How should I use it? Please give me an example.


Solution

  • If you have a valid CGPath, just do this:

    bezier_path = UIBezierPath(CGPath: your_cg_path)
    

    The vast majority of the yWithX type methods from Objective-C were replaced with init methods in Swift. This Apple documentation has more information on the subject.