Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift 3.0 converting error fix

I have a swift 2.2 project. Now I upgraded it to Swift 3.0 but I have some errors.

open var gridClippingRect: CGRect
{
    var contentRect = viewPortHandler?.contentRect ?? CGRect.zero
    contentRect.insetInPlace(dx: 0.0, dy: -(self.axis?.gridLineWidth ?? 0.0) / 2.0)
    return contentRect
}

error: Value of type 'CGRect' has no member 'insetInPlace'

How to fix this error?

like image 719
W.venus Avatar asked Jan 06 '23 07:01

W.venus


1 Answers

Looking at the docs for CGRect, the closest method is insetBy:dx:dy: which returns a new CGRect. So the following code should work for you:

contentRect = contentRect.insetBy(dx: 0.0, dy: -(self.axis?.gridLineWidth ?? 0.0) / 2.0)
like image 118
rmaddy Avatar answered Mar 13 '23 04:03

rmaddy