This episode is for subscribers only. To access it, and all past and future episodes, become a subscriber today!See subscription optionsorLog in
Sign up for our weekly newsletter to be notified of new episodes, and unlock access to any subscriber-only episode of your choosing!Sign up for free episode
Take our witness-oriented library and define some interesting strategies! Think about your own code base and specialized
Diffing) instances you can define. Here are some suggestions to get you started!
dump strategy on
Snapshotting<Any, String> that uses the output of Swift’s
dump function. You can reuse logic from the
recursiveDescription strategy to remove occurrences of memory addresses.
Snapshotting<URLRequest, String> strategy that snapshots a raw HTTP request, pretty-printing the method, headers, and body of the request.
Snapshotting<NSAttributedString, UIImage> strategy that snapshots images of attributed strings.
Snapshotting<NSAttributedString, String> strategy that snapshots HTML representations of attributed strings.
Apple’s eponymous WWDC talk on protocol-oriented programming:
At the heart of Swift’s design are two incredibly powerful ideas: protocol-oriented programming and first class value semantics. Each of these concepts benefit predictability, performance, and productivity, but together they can change the way we think about programming. Find out how you can apply these ideas to improve the code you write.
Facebook released a snapshot testing framework known as
FBSnapshotTestCase back in 2013, and many in the
iOS community adopted it. The library gives you an API to assert snapshots of
UIView’s that will take
a screenshot of your UI and compare it against a reference image in your repo. If a single pixel is off
it will fail the test. Since then Facebook has stopped maintaining it and transfered ownership to Uber.
Stephen gave an overview of snapshot testing, its benefits, and how one may snapshot Swift data types, walking through a minimal implementation.