I'm trying to get the max resolution of the user's display-- not necessarily the current resolution, but the maximum the display supports. I know that I can get the current resolution with something like this but I need the maximum (ie: on a MBP 13inch the resolution would be 2560x1600).
I know I can do this in Terminal using something like this, but I would like to avoid trying to do something hack-y in the Terminal, and instead do it with Swift. Any suggestions on how I can do this? Thanks.
You need to use Quartz Display Services. First, get a list of the displays, probably with CGGetActiveDisplayList
. Then, for each display, use CGDisplayCopyAllDisplayModes
. Iterate over the array of modes, using CGDisplayModeGetWidth
and CGDisplayModeGetHeight
to figure out which is highest resolution.