[Assert] Bounding path likely out of sync with its coordinate space: The view's bounds must contain the bounding rect

Hello everyone,


I got the captioned warning message when I tried to run the function invalidateContext(forBoundsChange newBounds: CGRect) with a UICollectionViewFlowLayoutInvalidationContext instant setting the property invalidateFlowLayoutAttributes to be true.


I intend to resize the UICollectionViewCell when bounds changes and the above execution successfully resized the cell. However, it gives this warning message.


Have been searched the answer but in vain.


Anyone would give me a clue?


Thanks in advance.

Replies

I get this when i expand a map view outside the bounds of a scrollview. I want to preserve it's top position when i play with the bouncing of the scrollview. So not sure if helps you but i don't think i can fix it.


"[Assert] Bounding path likely out of sync with its coordinate space: The view's bounds must contain the bounding rect. Bounding rect: {{0, 0}, {320, 487}}; coordinate space: <Spoto.SPPlaceDetailsView: 0x10962ba00; baseClass = UIScrollView; frame = (0 0; 320 487); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x2828ee580>; layer = <CALayer: 0x28264a1e0>; contentOffset: {0, -0.5}; contentSize: {320, 668}; adjustedContentInset: {0, 0, 0, 0}>"

I got this error.

If that may help someone, here is the context.


Core reason was that I returned a negative size in

func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { }


Scenario was the following:

in an animation, I set the collectionView fram transform to a 0.1 scale.

so that the frame shrinks, for a zoom out effect.


But in some cases, I did recall this sizeForItem, with this transform still applying.


Consequence, as I computed the size from the frame size, I ended with negative value.


I just reset the transform to Identity somewhere, and crash disappeared.