Check out example codes for "swift get a rectangle centered". It will help you in understanding the concepts better.

Code Example 1

let frameSize: CGPoint = CGPoint(x: UIScreen.main.bounds.size.width*0.5,y: UIScreen.main.bounds.size.height*0.5)

Learn ReactJs, React Native from akashmittal.com