Go to file
Jesse Squires 245e4c6957
add screenshot
2021-05-19 19:40:59 -07:00
.github Create dependabot.yml 2021-05-16 22:26:46 -07:00
Sources Add support for CocoaPods (#12) 2020-05-19 22:13:36 -07:00
scripts Misc updates (#19) 2020-12-03 23:44:22 -08:00
.gitignore Add Swift Package 2020-04-12 10:09:23 -07:00
.swiftlint.yml Update .swiftlint.yml 2020-05-19 21:42:19 -07:00
CHANGELOG.md Release 2.2.0 2020-10-18 14:34:05 -07:00
Dangerfile Misc updates (#19) 2020-12-03 23:44:22 -08:00
Gemfile [CI] update Xcode 11.5 (#17) 2020-05-25 14:31:41 -07:00
Gemfile.lock bundle update 2021-05-16 22:26:27 -07:00
LICENSE Initial commit 2019-09-30 12:52:26 -07:00
Nine41.podspec Release 2.2.0 2020-10-18 14:34:05 -07:00
Package.swift Swift 5.3 2020-10-18 14:28:19 -07:00
README.md Swift 5.3 2020-10-18 14:28:19 -07:00
screenshot.png add screenshot 2021-05-19 19:40:59 -07:00

README.md

Nine41 CI

Automate overriding the status bars for all running iOS simulators

About

Blog posts:

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.

Requirements

Installation

Swift Package Manager

Add Nine41 to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/jessesquires/Nine41.git", from: "2.0.1")
]

Alternatively, you can add the package directly via Xcode.

CocoaPods

pod 'Nine41'

Usage

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 8, 65A6C323-E74D-452C-B85E-7F576259E022
✅ iPhone 11, 52E8FAD0-7743-4F85-AA2E-26E4C1275F38

Example run with no open simulators:

$ nine41
Fixing status bars...
❌ No simulators are running. Launch the iOS simulator first.

Automation with Xcode build phases

As described in this post, you can automate your perfect status bars using Xcode build phases.

  1. Add the Swift package to your Xcode project
  2. Add a "Run Script" build phase with the following:

For Swift Package Manager installations:

/usr/bin/xcrun --sdk macosx swift run --package-path "${BUILD_ROOT}/../../SourcePackages/checkouts/Nine41"

For CocoaPods installations:

/usr/bin/xcrun --sdk macosx swift "${PODS_ROOT}/Nine41/Sources/main.swift"
  1. 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.

Contributing

Interested in making contributions to this project? Please review the guides below.

Also, consider sponsoring this project or buying my apps! ✌️

License

Released under an MIT License. See LICENSE for details.

Copyright © 2019-present Jesse Squires.