If you want to keep the itemSize same across devices you should consider calculating the interitemspacing based on the collection view content width.
If you want to keep the interitemspacing same then calculate the itemSize based on the collection view content width.
This is assuming you always want the same number of items on each row.
Alternately consider using Compositional Layout which provides more flexibility in configuring collection view layouts.
Compositional Layout
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: