Skip to content

Instantly share code, notes, and snippets.

@username0x0a
Last active November 22, 2020 18:13
Show Gist options
  • Save username0x0a/a1b1efc3aaa7660686a6edfd0b520a4c to your computer and use it in GitHub Desktop.
Save username0x0a/a1b1efc3aaa7660686a6edfd0b520a4c to your computer and use it in GitHub Desktop.
iOS Simulator frame normalizing script – helps keeping your Xcode 9.1+ Simulator windows in sane and effective sizes!
tell application "Simulator" to activate -- needs to be in front
tell application "System Events" to tell application process "Simulator"
try
repeat with wnd in windows
set t to name of wnd
set tbh to 22 -- toolbar height
if t contains "iPhone X" then
set size of wnd to {375, 812 + tbh}
else if t contains "iPhone" and t contains "Plus" then
set size of wnd to {414, 736 + tbh}
else if t contains "iPhone 8" or t contains "iPhone 7" or t contains "iPhone 6" then
set size of wnd to {375, 667 + tbh}
else
set size of wnd to {320, 568 + tbh}
end if
end repeat
on error errmess
log errmess
end try
end tell
@username0x0a
Copy link
Author

After a very nutritious debate over an issue on Apple Bug Tracker, some change is coming. Simulator app in Xcode 10 newly introduces a “Point accurate” option to scale the Simulator window thus making this script not needed anymore. Hooray!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment