4

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?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
W.venus
  • 470
  • 2
  • 6
  • 19

1 Answers1

9

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)
rmaddy
  • 314,917
  • 42
  • 532
  • 579
  • Thank you for your help. The error just fixed. Can you help another error (Swift 3.0) also? Now I have many errors in my updated project. – W.venus Sep 26 '16 at 04:10