Skip to content

Repository files navigation

Blacksmith

Support the project: Buy Me a Coffee at ko-fi.com

Previously distributed through: Gumroad ($0+)

Automated and localized App Store Screenshots without leaving Xcode.

Installation Instructions

Blacksmith supports installation via Swift Package Manager. To install, add the package via this url:

https://github.com/chFlorian/Blacksmith

Usage

Blacksmith is used to automatically generated simple App Store screenshots for multiple localizations.

1. Add Blacksmith to your UITest target & import Blacksmith

import Blacksmith
import XCTest
import SwiftUI
classForgeUITests:XCTestCase{

2. Create a testX function for each screen/locale that you want to create an image of

func testScreenshot_AddElementToLayoutBuilder()throws{letapp=XCUIApplication()

3. Specify a language that should be used for the export

 app.launchArguments =["-AppleLanguages","(en)"]
app.launch()

4. Navigate to the screen that should be exported

letwindow= app.windows.firstMatch
window.outlines.buttons["🛠 Layout Builder"].click()letaddElementButton= window.toolbars.buttons["Add Element"]
addElementButton.click()

5. Create a screenshot

letscreenshot= app.screenshot()

5. (A) Use the quickExportWithTitle function on screenshot

You can either use quickExportWithTitle directly on the XCUIScreenshot or follow step 6 and 7

6. Setup a Capturing View

letexportSize=ExportSize.mac
letcapturingView=ScreenshotWithTitle(
title:"Create your own image layouts.", image: screenshot.image, background:.color(.blue),
exportSize:.mac
)

7. Choose a location to export the image

leturl=FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("result.png")exportMarketing(image: capturingView, toURL: url)

8. Clean up

 app.terminate()}}

Full Code Example:

import Blacksmith
import XCTest
import SwiftUI
classForgeUITests:XCTestCase{func testExample()throws{letapp=XCUIApplication()
app.launchArguments =["-AppleLanguages","(en)"]
app.launch()letwindow=XCUIApplication().windows.firstMatch
window.outlines.buttons["🛠 Layout Builder"].click()letaddElementButton= window.toolbars.buttons["Add Element"]
addElementButton.click()letscreenshot= app.screenshot()letexportSize=ExportSize.mac
letcapturingView=ScreenshotWithTitle(
title:"Create your own image layouts.", image: screenshot.image, background:.color(.blue),
exportSize:.mac
)leturl=FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent("result.png")exportMarketing(image: capturingView, toURL: url)
app.terminate()}}

About

Automated ASC screenshots within Xcode

Topics

Resources

Stars

26 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages