Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

swift 3 and CGContextEOClip

Tags:

ios10

swift3

As I am converting my code to swift 3, I got this error:

error: 'CGContextEOClip' is unavailable: Use clip(using:)
                                CGContextEOClip(context!);
                                ^~~~~~~~~~~~~~~
CoreGraphics.CGContextEOClip:2:13: note: 'CGContextEOClip' has been explicitly marked unavailable here
public func CGContextEOClip(_ c: CGContext?)

I have no idea how to use clip(using:) and I don't see any documentation relating to it. Any ideas. Thanks Reza

like image 603
reza23 Avatar asked Sep 19 '16 17:09

reza23


1 Answers

In swift3 CGContextEOClip and CGContextClip are now methods of CGContext type

let context = /*your context*/
context.clip(using: .evenOdd) // for CGContextEOClip
context.clip(using: .winding) // for CGContextClip
like image 200
Jans Avatar answered Sep 25 '22 23:09

Jans