Swift 3.0 Bug Fixes

I have a quick project 2.2. 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: A value of type 'CGRect' has no member 'insetInPlace'

How to fix this error?

+4
source share
1 answer

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

contentRect = contentRect.insetBy(dx: 0.0, dy: -(self.axis?.gridLineWidth ?? 0.0) / 2.0)
+9
source

Source: https://habr.com/ru/post/1655780/


All Articles