Understanding Swift’s ConvertPoint
Which coordinate system are you in?
5 min readMar 15, 2023
Before we start
Difficulty: Beginner | Easy | Normal | Challenging
This article has been developed using Xcode 14.2, and Swift 5.7.2
Keywords and Terminology:
Bounds: Used in a Custom UIView to represent the drawing space’s origin and size
Frame: A rectangle in a superview’s coordinate space that contains the view’s bounds.size in its entirety
Prerequisites:
- You need to be able to create a basic Swift App. The example application I’ve built is created programmatically
The example App
This has been created programmatically, and essentially is three UIView
instances placed on a plain background. Please be aware that I’ve set the background as red to attempt to make it as easy as possible to see the two views on top of it.
I’ve created the three views as lazy vas. These have separate colours as follows -