Hi, my name is Donny
I'm a curious, passionate iOS Developer from The Netherlands who loves learning and sharing knowledge.
Take a look at my books
Practical Swift Concurrency
Learn everything you need to know to make optimal use of Swift Concurrency in your applications. This book covers everything from awaiting asynchronous method calls to building your own highly concurrent systems. It’s a great introduction for those looking to familiarize themselves with everything Swift Concurrency has to offer.
Buy on GumroadPractical Combine
Practical Combine is a book aimed at intermediate to advanced developers who want to learn more about Apple's Combine framework. This book takes you all the way from the basics to building custom Combine publishers using Practical, useful examples that you can start using immediately.
Buy on GumroadPractical Core Data
Practical Core Data is for intermediate to advanced developers who want to learn more about Core Data. Whether you're new to Core Data, or tried using it years ago, you'll find that Practical Core Data introduces you to all the essentials to get you up and running with the framework.
Buy on GumroadRecent articles
Jump to a random postSending vs Sendable in Swift
December 18, 2024With Swift 6, we have an entirely new version of the language that has all kinds of data race protections built-in. Most of these protections were around with Swift 5 in one way or another and in Swift 6 they've refined, updated, improved, and expanded these features, making them mandatory. So in Swift 5 you could get away with certain things where in Swift 6 these are now compiler errors. Swift 6 also introduces a bunch of new features, one...
Read more...Mocking a network connection in your Swift Tests
December 12, 2024Unit tests should be as free of external dependencies as possible. This means that you want to have full control over everything that happens in your tests. For example, if you're working with a database, you want the database to be empty or in some predefined state before your test starts. You operate on the database during your test and after your test the database can be thrown away. By making your tests not depend on external state, you make...
Read more...Testing completion handler based code in Swift Testing
December 4, 2024Swift's new modern testing framework is entirely driven by asynchronous code. This means that all of our test functions are async and that we have to make sure that we perform all of our assertions “synchronously”. This also means that completion handler-based code is not as straightforward to test as code that leverages structured concurrency. In this post, we’ll explore two approaches that can be useful when you’re testing code that uses callbacks or completion handlers in Swift Testing. First,...
Read more...Testing requirements with #require in Swift Testing
November 28, 2024In a previous post, I wrote about using the #expect macro to ensure that certain assertions you want to make about your code are true. We looked at testing boolean conditions as well as errors. In this post, I would like to take a look at a macro that goes hand-in-hand with #expect and that is the #require macro. The #require macro is used to ensure that certain conditions in your test are met, and to abort your test if...
Read more...Asserting state with #expect in Swift Testing
November 21, 2024I don't think I've ever heard of a testing library that doesn't have some mechanism to test assertions. An assertion in the context of testing is essentially an assumption that you have about your code that you want to ensure is correct. For example, if I were to write a function that's supposed to add one to any given number, then I would want to assert that if I put 10 into that function I get 11 out of it....
Read more...Improving test coverage with parameterized tests in Swift testing
October 31, 2024When you subscribe to the practice of test-driven development or just writing tests in general you'll typically find that you're going to be writing lots and lots of tests for pretty much everything in your codebase. This includes testing that varying inputs on the same function or on the same object result in expected behavior. For example, if you have a function that takes user input and you want to make sure that you validate that a user has not...
Read more...