• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automate overriding the status bars for all running iOS simulators

Nine41 CI

Automate overriding the status bars for all running iOS simulators


perfect status bar

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.0")
]

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.

More Repositories

1

JSQMessagesViewController

An elegant messages UI library for iOS
Objective-C
11,142
star
2

JSQDataSourcesKit

⚠️ Deprecated ⚠️
Swift
683
star
3

JSQCoreDataKit

A swifter Core Data stack
Swift
615
star
4

JSQSystemSoundPlayer

A fancy Obj-C wrapper for Cocoa System Sound Services
Objective-C
581
star
5

PresenterKit

⚠️ Deprecated ⚠️
Swift
551
star
6

Foil

A lightweight property wrapper for UserDefaults done right
Swift
457
star
7

JSQWebViewController

[Deprecated] A lightweight Swift WebKit view controller for iOS
Swift
305
star
8

TIL

Things I've learned and/or things I want to remember. Notes, links, advice, example code, etc.
282
star
9

JSQNotificationObserverKit

[DEPRECATED] Generic notifications and observers for Cocoa and CocoaTouch
Swift
167
star
10

JSQFlatButton

[DEPRECATED] A light-weight, flat design UIButton for iOS
Objective-C
120
star
11

DefaultStringConvertible

[DEPRECATED] A default CustomStringConvertible implementation for Swift types
Swift
119
star
12

swift-sorts

A collection of sorting algorithms implemented in Swift
Swift
106
star
13

esoteric-swift

A collection of obscure Swift programs. The less comprehensible, the better — just like normal code.
Swift
96
star
14

app-icons-script

Photoshop script to generate all iOS and macOS app icons
JavaScript
84
star
15

ReactiveCollectionsKit

Data-driven, declarative, reactive, diffable collections (and lists!) for iOS. A modern, fast, and flexible library for UICollectionView done right.
Swift
81
star
16

swift-proposal-analyzer

An analysis of Swift Evolution proposals
Swift
58
star
17

objc-sorts

A collection of sorting algorithms implemented in Objective-C
Objective-C
52
star
18

gh-workflows

A collection of useful generic GitHub Actions workflows
50
star
19

safari-tabs-to-omnifocus

AppleScript to export current Safari tabs to OmniFocus inbox items
49
star
20

jessesquires.com

Turing complete with a stack of 0xdeadbeef
HTML
45
star
21

JSQActivityKit

[DEPRECATED] Swift UIActivities for iOS
Swift
43
star
22

delete-uber

"There is no place for ethics in this business sweetheart." — a list of news articles (with excerpts) on Uber.
33
star
23

.github

Default community health files for all of my open-source projects
29
star
24

GrandSugarDispatch

[DEPRECATED] Syntactic sugar for Grand Central Dispatch (GCD)
Swift
27
star
25

ios-watchdog

Main thread watchdog for iOS
Objective-C
26
star
26

talks

Slides and materials for talks that I've given
Rich Text Format
25
star
27

template-iOS-macOS

Template repository for my iOS and macOS projects
Ruby
24
star
28

xcode-settings-backup

Backup of my Xcode configuration and various settings
Shell
21
star
29

icloud-backup-script

Backup your iCloud Drive documents using rsync
Shell
20
star
30

wwdc-notes

Taking notes on WWDC videos, new APIs, and announcements
13
star
31

drumpf

Safari Extensions are dead 💀 RIP.
JavaScript
10
star
32

playdate-learning

Learning how to make games for Playdate https://play.date
8
star
33

template-jekyll-site

Template repository for Jekyll websites
HTML
8
star
34

c-sorts

A collection of sorting algorithms implemented in C
C
8
star
35

FreedomFarts

Join the Fart Party! In God, We Fart.
Objective-C
5
star
36

rdar-19368054

Example project showing Swift compiler bug, rdar://19368054
Swift
2
star
37

likeyoungrecords

Website for Like Young Records. RIP.
PHP
2
star
38

a-world-without-police

A world without police
2
star
39

15puzzle.js

A 15 puzzle written in javascript - just a fun coding exercise
JavaScript
1
star
40

jessesquires.github.io

Open source projects homepage
1
star
41

sandbox-gh-workflows

A sandbox repo for testing GitHub Actions workflows
Ruby
1
star