reza23
reza23

Reputation: 3385

swift 3 and CGContextEOClip

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

Upvotes: 5

Views: 818

Answers (1)

Jans
Jans

Reputation: 11250

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

Upvotes: 10

Related Questions