Custom CALayer with properties crashes on iOS 9 devices

Hello,


The new Xcode 11.4 seems to create a problem when programmatically creating custom CALayer objects containing some properties. To see this problem, Create an extension of an CALayer:


class CustomLayer: CALayer {
   var someProperty: CGFloat = 0
}


Now programmatically create such a layer, e.g. in a viewDidLoad


let customLayer = CustomLayer()


Compile and run this on a iOS 9 device (my tests were with an iPhone 4S with iOS 9.3.6). The device crashes when initializing the layer. It is deallocated BEFORE it can actually set the property on the customLayer. Enable zombies for a more detailed stack trace.


Is there a workaround for this problem? Will there be fix?


Compiling the same code with an older Xcode e.g. 13.1 does not crash the iOS 9 device.


We cannot upgrade to the new Xcode since our app is designed for iOS 9+.

Custom CALayer with properties crashes on iOS 9 devices
 
 
Q