How Swift apps log, crash and test
17 logging, crash and test words in public Swift files as of 1 November 2026.
Free for one project and 100 votes. Paid plans start with a 14 day trial, no card.
The top ten
XCTestCase is in 1,222,656 files, the most of the 17 words.
| Word | Files |
|---|---|
| XCTestCase | 1,222,656 |
| fatalError( | 637,952 |
| XCUIApplication | 178,176 |
| Logger(subsystem | 96,128 |
| NSLog | 78,080 |
| import OSLog | 75,776 |
| preconditionFailure( | 44,352 |
| assertionFailure( | 41,920 |
| launchArguments | 26,496 |
| XCTestExpectation | 20,480 |
Logging
Logger(subsystem is in 5.1 times the files of os_log.
| Apple logging word | Files |
|---|---|
| Logger(subsystem | 96,128 |
| NSLog | 78,080 |
| import OSLog | 75,776 |
| os_log | 19,008 |
| OSSignposter | 2,436 |
Failing on purpose
fatalError( is in 14.4 times the files of preconditionFailure(.
fatalError( is also in 6.6 times the files of Logger(subsystem.
| Failure call | Files |
|---|---|
| fatalError( | 637,952 |
| preconditionFailure( | 44,352 |
| assertionFailure( | 41,920 |
Crash reports
import OSLog is in 73.0 times the files of import MetricKit.
MXCrashDiagnostic is in 188 files, 22.5 for every 100 with MXMetricManager.
| MetricKit word | Files |
|---|---|
| import MetricKit | 1,038 |
| MXMetricManager | 835 |
| MXCrashDiagnostic | 188 |
Unit tests
XCTestCase is in 59.7 times the files of XCTestExpectation.
The unit test group has the highest median of the four groups, 621,568 files.
| Unit and UI test word | Files |
|---|---|
| XCTestCase | 1,222,656 |
| XCTestExpectation | 20,480 |
| XCUIApplication | 178,176 |
| launchArguments | 26,496 |
| XCUIScreenshot | 734 |
UI tests
XCUIApplication, the start of a UI test, is in 178,176 files, 6.7 times launchArguments with 26,496.
XCUIApplication is in 14.6 files for every 100 with XCTestCase.
launchArguments is in 14.9 files per 100 with XCUIApplication, and XCUIScreenshot in 0.4.
XCUIApplication is in 243 times the files of XCUIScreenshot with 734, and launchArguments in 36.1 times.
Files that name both XCUIApplication and accessibilityIdentifier number 1,246, 0.7 for every 100 with XCUIApplication.
Seven pairs
Seven pairs of words set a common call against its newer or rarer neighbor, and the ratios run from 1.2 to 73.0.
import OSLog over import MetricKit is the widest pair, 73.0 to 1.
The XCTestCase pair is next at 59.7, and the closest is Logger(subsystem over NSLog at 1.2.
| Pair | Ratio |
|---|---|
| import OSLog / import MetricKit | 73.0 |
| XCTestCase / XCTestExpectation | 59.7 |
| fatalError( / assertionFailure( | 15.2 |
| fatalError( / preconditionFailure( | 14.4 |
| XCUIApplication / launchArguments | 6.7 |
| Logger(subsystem / os_log | 5.1 |
| Logger(subsystem / NSLog | 1.2 |
The rarest
MXCrashDiagnostic is in 188 files, the fewest of the 17.
import MetricKit is in 5.5 times the files of MXCrashDiagnostic.
| Four of the five least common | Files |
|---|---|
| import MetricKit | 1,038 |
| MXMetricManager | 835 |
| XCUIScreenshot | 734 |
| MXCrashDiagnostic | 188 |
By group
The diagnostics group spreads 3,393 to 1, the widest.
UI tests spread 243 to 1, unit tests 60 to 1 and Apple logging 39 to 1.
| Group | Most | Fewest |
|---|---|---|
| Apple logging | 96,128 | 2,436 |
| Diagnostics | 637,952 | 188 |
| Unit tests | 1,222,656 | 20,480 |
| UI tests | 178,176 | 734 |
What is in the file
A count for each word
5 Apple logging words, 6 failure and crash words, 2 unit test words and 4 UI test words.
Words set against a base
XCUIApplication and launchArguments per 100 files.
Ratios you can quote
Logger(subsystem is in 5.1 times the files of os_log.
No code and no names
The file holds counts only, with no repository and no developer.
How the files were counted
One search per word.
Write 17 searches
Each search names one logging, failure, crash report or test word, matched as a word or as exact text in Swift files.
Ask the code search
One request per search, with at least seven seconds between requests.
Ask again when incomplete
Whenever the service called a result incomplete, the search went out again, up to three times.
Keep the count
Each CSV row holds a word, its count and its search. No code is kept.
How a package should log and be tested
Logging is split between old and new. NSLog is in 78,080 files, Logger(subsystem in 96,128 and import OSLog in 75,776, so a package that logs through Logger with its own subsystem uses the form that leads.
XCTestCase is in 1,222,656 files and XCUIApplication in 178,176, yet only 1,246 pair XCUIApplication with accessibilityIdentifier. A board that gives each vote button an identifier makes the few who write such tests faster. Crash and metric reports are rarer still, with import MetricKit in only 1,038 files.
What these numbers leave out
- These are files and not apps or users, and not how well an app is tested.
- The search rounds large counts, so words within about 10 percent of each other are level.
- NSLog, launchArguments and fatalError( are plain words, so a file may use them outside logging or tests.
- Only Apple words are counted here, so files that use another logging or test library are missed.
- Logger(subsystem matches only a logger written that way, so a logger made another way is missed.
- A copied sample counts each time, the search leaves out most forks, and no code was read.
Swift logging and testing questions
Which Apple logging call is in the most files?
Logger(subsystem, in 96,128 files, ahead of NSLog with 78,080.
Is os_log still common?
It is in 19,008 files, against 96,128 for Logger(subsystem.
How many files stop on purpose with fatalError?
fatalError( is in 637,952 files, 15.2 times assertionFailure(.
How many files use MetricKit crash reports?
import MetricKit is in 1,038 files and MXCrashDiagnostic in 188.
How many Swift files hold unit tests?
XCTestCase is in 1,222,656 files, the most of the 17 words.
How many files wait for async work in a test?
XCTestExpectation is in 20,480 files, 59.7 times fewer than XCTestCase.
How common are UI tests?
XCUIApplication is in 178,176 files, 14.6 for every 100 with XCTestCase.
Do UI tests pass launch arguments?
launchArguments is in 26,496 files, 14.9 for every 100 with XCUIApplication.
Which word is in the fewest files?
MXCrashDiagnostic, in 188 files, the fewest of the 17.
Does this count apps?
No. It counts files, and a copied sample counts each time.
Does the file hold any code?
No. It holds a count and the search for each word.
May a site quote these figures?
Yes. Quote any count beside a link back to this page and the count date, 1 November 2026.
More Swift code, counted
More counts for Swift and iOS developers.
SwiftData, Core Data and CloudKit counted in Swift files
22 storage and sync words counted in public Swift files.
VoiceOver, Dynamic Type and dark mode counted in Swift apps
29 accessibility, dark mode and haptics words counted.
SwiftUI vs UIKit and 22 more Apple frameworks, counted
24 Apple frameworks counted in public Swift files.
Foundation Models, Core ML and Vision counted in Swift apps
10 on device framework words counted.
Collect feature requests in an iOS app
Your first board is free, with one project and 100 votes. The 14 day trial of Lite or Pro needs no card.