Create AppStore Images with one liner
Source: Dev.to

As an iOS developer, the absolute worst part of releasing an app is creating App Store screenshots.
There are expensive micro‑SaaS tools out there, but they just take your money while you still end up doing a lot of manual work. Here’s a personal solution that kills two birds with one stone:
- Automate App Store screenshots
- Write UI tests and increase code coverage
Below is a step‑by‑step guide.
Step 1: Take Screenshots with XCTest
Write a simple UI test and use XCTest to capture a screenshot. Keep the attachment so Xcode saves it.
let screenshot = XCUIScreen.main.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways
attachment.name = "AppStore_Home"
add(attachment)
Step 2: Run Your Tests
Run the UI tests in Xcode (Cmd + U). Xcode automatically stores all screenshots inside a hidden .xcresult bundle.
Step 3: Export to Desktop Using a Custom CLI Command
Instead of a long bash script, create a tiny CLI helper with xcparse (install via Homebrew). Add the following function to your ~/.zshrc (or ~/.bash_profile):
# Add this to your .zshrc
extract_screens() {
LATEST_RESULT=$(find ~/Library/Developer/Xcode/DerivedData -name "*.xcresult" -type d \
-exec stat -f "%m %N" {} + | sort -rn | head -1 | cut -d' ' -f2-)
mkdir -p ~/Desktop/Screenshots
xcparse screenshots "$LATEST_RESULT" ~/Desktop/Screenshots
echo "🚀 Success! Screenshots extracted to your Desktop."
}
Restart your terminal. After your tests finish, simply run:
$ extract_screens
All your App Store screenshots will appear in ~/Desktop/Screenshots. You’ve saved money, saved time, and added valuable UI tests.
How do you currently handle your App Store screenshots? Let me know in the comments!