I wanted to change the collection view's contentOffset.x right after pushing VC.
So I called collectionView.setContentOffset(~) in viewWillAppear.
But It didn't work because of auto layout cycle.
However, if I call collectionView.setContentOffset inside DispatchQueue.main.async block, IT WORKS!
The code is below:
override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    DispatchQueue.main.async {
        collectionView.setContentOffset(
            CGPoint(x: currentFolderIndex * collectionView.bounds.width), y: 0), 
            animated: false
        )
    }
}
I figured out why it had worked when I printed the order of layout methods.
DispatchQueue.main.async block is called after viewDidLayoutSubviews.
Does it always work like this?
Why does it work like this?
I'm so curious!!

 
    