There is tangible profit from automating screenshots, first of all, you can create screenshots of the App for App Store on any languages and localizations. Secondly, when the app is on the process of localization, it should be sent to native speakers to check if the language is used correctly. And also for this you should make screenshots of all the screens and localizations. In case of App Store you need just several TOP screens but for checking the localization you’ll need all the screens. As the result, in several minutes you’ll get all the screens in all localizations and sizes. If to take 1 screen for 10 devices and 25 localizations, you’ll need 250 screenshots.
Let’s create a test project ScreenshotsProject
Add the target for tests ScreenshotsProjectUITests
For the project we will need dependency Cocoapods:
Localize-Swift – for changing the localization
iOSSnapshotTestCase – for the screenshots
Podfile

Create test ViewController and xib for it view

The color view will make different from the color label and stretch label around all the area of SafeArea in order to control the correctness of the elements rendering taking into account SafeArea

Create the file of Localizable.strings and several localizations for it

Add code to AppDelegate, in addition display ViewController with UINavigationController in UITabBarController

The result of the performance

In the target ScreenshotsProjectUITests add Asset Catalog and also pictures of all necessary sizes for StatusBar

In the target ScreenshotsProjectUITests create the file Device.swift with enum Device and enum Orientation

Add extension for Device

Add scale factor for Device

In the target ScreenshotsProjectUITests create file ScreenshotsProjectUITests+Help.swift where we will add support functions.
ScreenshotsProjectUITests+Help.swift
Add extension for UIViewController and in it add the function for adding a picture for StatusBar

Also in extension UIViewController add:
correction function for SafeArea insets

Сorrection function of TabBar frame

Сorrection function of NavigationBar frame

For correct rendering we should use right Trait Collections depending on the device and orientation.
In ScreenshotsProjectUITests+Help.swift we also add the function of getting Trait Collections for the device and orientation.

In addition, we will need several auxiliary functions

The screenshots will be created with UIWindow, so you should add the last auxiliary function.
It will create UIWindow for our ViewController depending on the device and orientation


Almost everything is ready for creating the screenshots
We just need to add the work with Localize-Swift in the target ScreenshotsProjectUITests
Crete file Localize+Bundle.swift and add it to extension for Localize

While creating the target ScreenshotsProjectUITests, ScreenshotsProjectUITests.swift file has been created.
We have to change it

After you start the test testScreenShot(), the screenshots are generated for all devices and in all accessible localizations.


Now you can see how the automating process works. It will save your time and efforts.