Type Safely

Type Safely

Unit Test SwiftUI Visually With Snapshot Testing

Daily Coding Tip 060

Millie Sturgeon's avatar
Millie Sturgeon
Apr 13, 2022
∙ Paid
Image by StockSnap from Pixabay

The SnapshotTesting library provides a lot of easy ways to test UI code without automated UI testing.

It essentially generates screenshots of anything in UIKit, and since we can wrap SwiftUI views in a UIHostingController, SwiftUI as well.

Create a new Xcode SwiftUI project and call it whatever you want, I called mine Test…

User's avatar

Continue reading this post for free, courtesy of Type Safely.

Or purchase a paid subscription.
© 2026 Type Safely · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture