Application does not crash when calling setNeedsLayout() on background thread
andriichernenko opened this issue · 1 comments
andriichernenko commented
Executing the following code snippet in the app does not cause crash:
dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0)) {
self.collectionView?.setNeedsLayout()
}
Couple of things I checked:
- Code is executed
- The thread is different from main
self.collectionView
is notnil
onmyway133 commented
@deville I use this code, and it asserts me
override func viewDidLoad() {
super.viewDidLoad()
let layout = UICollectionViewFlowLayout()
let collectionView = UICollectionView(frame: CGRectZero, collectionViewLayout: layout)
view.addSubview(collectionView)
dispatch_async(dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0)) {
collectionView.setNeedsLayout()
}
}