Drawing path from gesture CALayerInvalidGeometry

Started getting this error on Beta 5, while drawing a path taken from a user gesture.

Doesn't always happen, never had this problem on iOS 13 or even Beta 3. (did not try 4).

The position is not NaN, same code works on Beta 3

  • ** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]. Layer: <TtC7SwiftUIP33F176A6CF4451B27508D54E2BEAEBFD5415ColorShapeLayer:0x6000033efa80; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <TtC7SwiftUIP33A34643117F00277B93DEBAB70EC0697122UIShapeHitTestingView: 0x7fa7c4e1f2c0; frame = (0 0; 0 0); anchorPoint = (0, 0); autoresizesSubviews = NO; layer = <TtC7SwiftUIP33_F176A6CF4451B27508D54E2BEAEBFD5415ColorShapeLayer: 0x6000033efa80>>; allowsEdgeAntialiasing = YES; allowsGroupOpacity = YES; anchorPoint = CGPoint (0 0); lineDashPattern = (

); lineWidth = 3; strokeColor = <CGColor 0x6000017b9fe0> [<CGColorSpace 0x600001795b00> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1; extended range)] ( 0 0 0 1 ); fillColor = <CGColor 0x6000017ba100> [<CGColorSpace 0x600001795b00> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1; extended range)] ( 0 0 0 0 ); path = <CGPath 0x60000018cab0>>'

terminating with uncaught exception of type NSException

CoreSimulator 732.13 - Device: iPhone 8 (14A5AC85-61B7-414B-A5D9-7118D1079B64) - Runtime: iOS 14.0 (18A5351d) - DeviceType: iPhone 8


Any ideas?
Cheers





I have a similar problem, also no idea what is wrong, I don't see any Nan in the log

CALayer position contains NaN: [nan nan]. Layer: <TtC7SwiftUIP33F176A6CF4451B27508D54E2BEAEBFD5415ColorShapeLayer:0x600002034da0; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <TtC7SwiftUIP33A34643117F00277B93DEBAB70EC0697122UIShapeHitTestingView: 0x7f80fbcb7dc0; frame = (0 0; 0 0); anchorPoint = (0, 0); autoresizesSubviews = NO; layer = <TtC7SwiftUIP33_F176A6CF4451B27508D54E2BEAEBFD5415ColorShapeLayer: 0x600002034da0>>; allowsEdgeAntialiasing = YES; allowsGroupOpacity = YES; anchorPoint = CGPoint (0 0); lineDashPattern = (

); lineWidth = 3; strokeColor = <CGColor 0x6000004e8540> [<CGColorSpace 0x6000004e4060> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1; extended range)] ( 1 0.231373 0.188235 1 ); fillColor = <CGColor 0x6000004ea8e0> [<CGColorSpace 0x6000004e4060> (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1; extended range)] ( 0 0 0 0 ); path = <CGPath 0x6000012e4990>>
Same issue when trying out beta 5. Works fine with beta 2 or current release version of Xcode
I've been seeing the same issue occasionally since iOS 13. Typically after doing something like:
  1. Present UIViewController that uses UIHostingController

  2. Dismiss

  3. Present again

  4. Crash

But also sometimes on the first presentation. It will happen one or two times in a row, then disappear for days. Seems random.
Drawing path from gesture CALayerInvalidGeometry
 
 
Q