collectionView flowLayout

I have collection view inside tableview cell the problem is when I change semanticContentview of the collection view the collection view for the first time not taking the full width of the screen for the first cell only as below:

and this for foreceLeftToRight:

here is the code in my tableview cell     var width:CGFloat!{didSet{

        if let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout{

            flowLayout.estimatedItemSize = CGSize(width: width-10, height: 300)

            flowLayout.scrollDirection = .horizontal

            flowLayout.minimumInteritemSpacing = 10

            flowLayout.minimumLineSpacing = 10

            flowLayout.collectionView?.translatesAutoresizingMaskIntoConstraints = false

            flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 5)

            flowLayout.collectionView?.clipsToBounds = false

        }

        

    }}

    override func awakeFromNib() {

        super.awakeFromNib()

        initXib()

        collectionView.delegate = self

        collectionView.dataSource = self

        collectionView.isPagingEnabled = true

        collectionView.semanticContentAttribute = .forceRightToLeft

    }

collectionView flowLayout
 
 
Q