ashfurrow / Nimble-Snapshots

Nimble matchers for FBSnapshotTestCase.
https://medium.com/cocoaacademymag/unit-testing-uiview-with-nimble-snapshot-651a7c5a5e93
MIT License
319 stars 102 forks source link

Support snapshotting SwiftUI views #283

Open younata opened 2 months ago

younata commented 2 months ago

Protocols can't be extended to conform to other protocols, sadly. So this duplicates the haveValidSnapshot/recordSnapshot matchers with ones that take in a SwiftUI View. Then, inside of that, the SwiftUI View is converted to a Snapshotable, and we delegate to the appropriate matcher for snapshotable.

Fixes #252

ashfurrow commented 1 month ago

(The Danger failure isn't due to your change, it's a permissions issue. I'm thinking of removing it entirely to prevent me from responding to every PR from a fork with "the failure isn't your fault!")