Test-Driven Development is an excellent way of writing code but many people push back against it. To convince your team to adopt it, lead by example. Don't preach. Let the quality of the code your wrote with TDD talk for itself and only suggest TDD when people ask about it.
I published a YouTube video with a tutorial on implementing the FizzBuzz algorithm using Test-Driven Development. While recording, I made a couple of thinking or coding mistakes, and, sure enough, the tests immediately pointed them out.
To test SwiftUI applications, don't test SwiftUI code. The SwiftUI framework doesn't lend itself to writing unit tests so don't try to shoehorn views in your test harness. Instead, split layout declaration form content generation logic.
My book, Test-Driven Development in Swift, is now available in online bookstores everywhere. You'll learn Test-Driven Development writing a real-world SwiftUI application, including events-flow management with Combine, networking, local storage, and third-party libraries.
Camille Fournier encourages us to "Make Boring Plans" and move in small iterations.
The "You Don't Need It Yet" technique to ship software on a schedule results in fast real-world feeback. The same mindset can be applied with Test-Driven Development to move between the Red, Green, and Refactor stages faster.
With test driven development you can write high quality software in small shippable steps. Here's how to get started.
Test driven development works at its best when you refactor as you go. Write the failing test, write just enough code to make it pass, then and only then focus on making that code good.
A look at the benefits of writing unit tests before production code, in other words TDD.
Nimble is a matchers framework built for Swift that provides powerful and versatile expectations. Writing test within the standard XCTest harness but using Nimble assertions is easier and productive, and a good combination of tools to introduce testing and TDD to colleagues and teams in a frictionless way.