Software Dev

Test your SwiftUI views at rocket speeds πŸš€ with ViewInspector πŸ•΅οΈβ€β™‚️

For years, at least in the iOS world, the idea of automatically testing your UI views was considered out of pocket. After all, the UIKit views lived in non-code files such as a storyboard or a – good lord! – a XIB.

Then came Apple’s XCUI framework, which allows for automatic UI test but takes, more or less, forever to run. I’ve seen XCUI test plans run for 3 hours, 6 hours, even 24 hours. It kind of works for a nightly test on a dedicated server, but not in realtime as you code.

But with SwiftUI, you get concise, clean, cross-platform view-layer code and can now test SwiftUI view as, well, code! This mean you can unit test your views 🀯, thanks in particular to the open source ViewInspector framework.

πŸ‘‰ ViewInspector on GitHib

ViewInspector lets you traverse your view hierarchy at runtime, asserting values as you go in traditional unit-test style.

According to the Inspection Guide, ViewInspector supports dynamic testing of @Binding, @ObservedObject, @State, @Environment and @EnvironmentObject. You can even interact with the interface, such as tapping a button and checking the result.

And it all runs in blazing fast unit test speed πŸš€ so your tests don’t have to run all night.

If you still want to do some actual visual testing, consider snapshot testing or mix in some limited XCUI tests for the right balance.

Now you can go write something cool and iterate fast. Thank you, nalexn, for this great tool. πŸ™

Software Dev

Automatically resolve Xcode project file conflicts

Xcode project files are complex and not meant to be human-readable, so they can be scary to merge. When there’s a conflict, it’s never fun.

The tool Kintsugi intends to automatically solve these conflicts for you “99.9% of the time.”

πŸ‘‰Automatically merging conflicts in Xcode project files | github

The name Kintsugi (ι‡‘ηΆ™γŽ) is well-chosen, meaning “the art of repairing broken pottery by mending it with gold.” 🀯

Another interesting note: this project relies on a framework called Xcodeproj that lets you create and modify Xcode project files automatically. That sounds likes a better alternative than a homespun shell script. πŸ‘

via iOS Dev Weekly

Software Dev

Introducing Swift Collections

Swift Collections is out with some new collection-oriented extensions on the Swift language as a companion to Swift Algorithms and Swift Numerics.

πŸ‘‰ Introducing Swift Collections | github

Swift Collections gives you hybrid collection types like Deque, which is an array with “efficient insertions and removals at both ends”, OrderedSet, which is a “powerful hybrid of an Array and a Set”, and OrderedDictionary (like the actual dictionary).

And of course, they’re efficient. Now go forth and collect in new ways!

Software Dev

Swift Algorithms

Apple announced an open-source algorithms project with some very over-the-top, flashy language. πŸ˜‰

I’m excited to announce Swift Algorithms, a new open-source package of sequence and collection algorithms, along with their related types.

πŸ‘‰ Announcing Swift Algorithms

This library seems to be a sort of farm league for things that might make it to big leagues of the Swift Standard Library eventually.

Swift Algorithms lets you do just about anything you can think of with a collection (or two). It lets you do stuff like rotate [10, 20, 30, 40, 50, 60] to [30, 40, 50, 60, 10, 20], or find all possible permutations of [10, 20, 30], and lots of other things like chunking, random sampling, etc. Fun. πŸ€“

Via iOS Dev Weekly.