I've a custom UIView to render a large piece of text using CATiledLayers. My draw(rect:) implementation is quite simple:
This code works without any issue on iOS 13, but fails with a crash on iOS 14 simulator:
I can see that draw(rect:) is being called from different threads in both iOS 13 and 14. However the EXC_BAD_ACCESS has never happened so far in iOS 13.
I wonder whether this is a behaviour change in iOS 14 or an issue. If this is a change in NSLayoutManager, then is it still possible to use CATiledLayer to render large amount of text in coordination with NSLayoutManager?
Code Block swift override func draw(_ rect: CGRect) { let range = layoutManager.glyphRange(forBoundingRect: rect, in: textContainer) layoutManager.drawBackground(forGlyphRange: range, at: .zero) layoutManager.drawGlyphs(forGlyphRange: range, at: .zero) }
This code works without any issue on iOS 13, but fails with a crash on iOS 14 simulator:
Code Block Thread 9: EXC_BAD_ACCESS (code=1, address=0x28) #0 0x00007fff2396a3f5 in _NSLayoutTreeMoveToGlyphIndex ()
I can see that draw(rect:) is being called from different threads in both iOS 13 and 14. However the EXC_BAD_ACCESS has never happened so far in iOS 13.
I wonder whether this is a behaviour change in iOS 14 or an issue. If this is a change in NSLayoutManager, then is it still possible to use CATiledLayer to render large amount of text in coordination with NSLayoutManager?