I'm really confused about how iOS Ruler apps are currently compatible with devices of different sizes. An example is shown below.
After research, I came to the conclusion that obtaining the PPI of the current screen in real time was impossible, which makes it impossible to programmatically draw the line.
My request is: how do these linear applications accurately display the line, without being able to get PPI devices?
My first thought was that the PPI and screen size for each device are hardcoded in the application. It seems like a lot of effort and a recipe for a million mistakes. Is this really how they should do it? It must be tested on each of the different devices to ensure that it works correctly. I only have access to my iPhone 5S. Can they have different ruler images for every other device? This would take up a lot of space on the phone.
I saw similar questions about SO about drawing rulers, but (correct me if I'm wrong) they don't seem to have a solution to maintain accuracy for different screen sizes and PPIs. They all seem to say "this is impossible." If this is not possible, how to do it?

ios objective-c swift
Invalid memory
source share