Automate overriding the status bars for all running iOS simulators
Blog posts:
- Fully automating perfect status bar overrides for iOS simulators with Nine41
- A script to automate overriding iOS simulator status bar values
- Overriding status bar display settings in the iOS simulator
Xcode 11 shipped with simctl status_bar
, a tool to override the status bar values in the simulator so you can take perfect screenshots.
However, it has some issues:
- The overrides do not persist across launches of the simulator
- The numerous override options are difficult to remember
- There are no sensible defaults
This script fixes most of those issues. It overrides the status bars for all currently running simulators using "Apple's defaults" — full cellular bars, full wifi bars, full battery, no "carrier" name, and 9:41
for the time.
- Swift 6.0+
- Xcode 16.0+
Add Nine41
to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/jessesquires/Nine41.git", from: "4.0.0")
]
Alternatively, you can add the package directly via Xcode.
After cloning the repo, you can create a custom bash command:
function nine41() {
swift run --package-path /PATH/TO/Nine41/
}
Then you can run this from the command line.
Example run with 2 open simulators:
$ nine41
Fixing status bars...
✅ iPhone 15, 65A6C323-E74D-452C-B85E-7F576259E022
✅ iPhone 16 Pro, 52E8FAD0-7743-4F85-AA2E-26E4C1275F38
Example run with no open simulators:
$ nine41
Fixing status bars...
❌ No simulators are running. Launch the iOS simulator first.
As described in this post, you can automate your perfect status bars using Xcode build phases.
- Add the Swift package to your Xcode project
- Add a "Run Script" build phase with the following:
/usr/bin/xcrun --sdk macosx swift run --package-path "${BUILD_ROOT}/../../SourcePackages/checkouts/Nine41"
- Build and run. Note that simulators must be booted for the script to work, which means the very first run may not produce results but the subsequent runs will.
Interested in making contributions to this project? Please review the guides below.
Also, consider sponsoring this project or buying my apps! ✌️
Released under an MIT License. See LICENSE
for details.
Copyright © 2019-present Jesse Squires.