Take screenshots with clean statusbar in Xcode Simulator
App Store Marketing Resources and Identity Guidelines suggests that the status bar for iPhone, iPad, and iPod touch screenshots should show a full network icon or product designator, a full Wi-Fi icon, and a full battery icon. To keep it consistent with Apple screenshots, I like to set the time to 9:41 am as well.
Xcode provides a utility to help us interact with iOS/iPadOS Simulator. It is called simctl
and we use it from Terminal.app. It helps us boot simulators from terminal, take screenshots, record videos. It also helps us change status bar values like time, battery percentage, etc. To view all the stuff that simctl can do, type the following command in terminal:
xcrun simctl help
To control the status bar, we use status_bar
command of simctl
. It overrides status bar values. To see all the flags that you can override, type this following command in terminal:
xcrun simctl help status_bar list
Command Line Tools
To use simctl
utility, we must have set the path for Command Line Tools. You can do that by going to Xcode > Prefrences > Locations > Command Line Tools. An empty value means the location is not set. Click on it and select the latest version of Xcode from the menu.
iPhone Screenshots
To override the status bar for iPhone, copy paste this in terminal.
xcrun simctl status_bar booted override --time "9:41 AM" --operatorName "" --wifiBars 3 --cellularBars 4 --batteryLevel 100
What this command does is, it uses simctl
utility to override all the currently booted simulators with the flags provided. These flags are:
- time: This sets the time in status bar to 9:41 AM.
- operatorName: This sets the carrier name to an empty string so that on older phone which shows carrier name in status bar, it hides the carrier name.
- wifiBars: This sets the Wi-Fi icon bars to full 3 bars.
- cellularBars: This sets the Cellular icon bars to full 4 bars.
- batteryLevel: This sets the battery percentage to 100%.
Now the status bar looks clean! You can also set the 'dataNetwork' flag to '5g'.
To clear/ restore the status bar, use this command:
xcrun simctl status_bar booted clear
iPad Screenshots
The same command to change the status bar on iPhone simulator works on iPad. iPad status bar just displays the current date as well.
If the string provided in the command for time is a valid ISO date string, it also sets the date in status bar on iPad.
xcrun simctl status_bar booted override --time "2021-06-22T09:41:00+05:30" --operatorName "" --wifiBars 3 --cellularBars 4
In this command, the time string "2021-06-22T09:41:00+05:30" sets the date to 22 June, 2021 and the time to 9:41 am. +05:30 is my time zone. Make sure to use the correct format otherwise it won't work.
watchOS Screenshots
Sadly, status bar overrides don't work on watchOS simulator. I edit the screenshots manually in Sketch to set the time to 10:09 am.
I have exported the files, you can use them in your own screenshots.
Status bar for 40mm watch:
Status bar for 44mm watch:
This way, you can have clean status bar for iOS, iPadOS, and watchOS.