Skip to main content

iOS Screenshot Automation Using View Snapshots

If you’ve been around the block as an iOS developer, you may have used UI tests before. They allow you to automatically test your app by simulating taps and key presses. It’s like having a virtual user of your app.

Using Fastlane, you can even use UI tests to automate taking your App Store screenshots.

Screenshots for the App Store must be supplied to Apple in at least two different device sizes (four if you support the iPad), and preferably they should be localized for each language your app supports. The process of taking all these screenshots by hand is time-consuming, as you can imagine. So it’s nice that we can automate it!

However, there’s a problem with UI tests.

Using the Readable Content Guides in SwiftUI

When making apps with UIKit, I often use the readable content guides in my layouts. They are auto layout guides that you can use to constrain the width of a view so that the text within it is easy to read. As Apple states it in the documentation:

This layout guide defines an area that can easily be read without forcing users to move their head to track the lines.

When I started building apps in SwiftUI, I wanted to use it there too. But this API is currently not exposed to SwiftUI.