Testing completion handler based code in Swift Testing
Donny Wals Blog
by donnywals
5d ago
Swift'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 ..read more
Visit website
Testing requirements with #require in Swift Testing
Donny Wals Blog
by donnywals
1w ago
In 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 ..read more
Visit website
Improving test coverage with parameterized tests in Swift testing
Donny Wals Blog
by donnywals
1M ago
When 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 ..read more
Visit website
Testing completion handler APIs with Swift Testing
Donny Wals Blog
by donnywals
1M ago
The Swift testing framework is an incredibly useful tool that allows us to write more expressive tests with convenient and modern APIs. This is my first post about Swift Testing, and I’m mainly writing it because I wanted to write about something that I encountered not too long ago when I tried to use Swift ..read more
Visit website
What is dependency injection in Swift?
Donny Wals Blog
by donnywals
2M ago
Code has dependencies. It’s something that I consider universally true in one way or another. Sometimes these dependencies are third party dependencies while other times you’ll have objects that depend on other objects or functionality to function. Even when you write a function that should be called with a simple input like a number, that’s ..read more
Visit website
Getting started with Mesh Gradients on iOS 18
Donny Wals Blog
by donnywals
2M ago
With iOS 18, we have the possibility to create mesh gradients. Mesh gradients are a really nice way to create very cool UI effects. In this post, we're going to explore exactly what mesh gradients are, how we can use them, and how we can even animate them to look really cool. We’ll start off ..read more
Visit website
Animating SF Symbols on iOS 18
Donny Wals Blog
by donnywals
3M ago
Over the years, Apple has been putting tons of work into the SF Symbols catalog. With SF Symbols, we’re able to leverage built-in iconography that will look familiar to users while also fitting into the Apple ecosystem very nicely. The fact that there’s thousands of symbols to choose from makes it a highly flexible and ..read more
Visit website
Solving “Value of non-Sendable type accessed after being transferred; later accesses could race;”
Donny Wals Blog
by donnywals
3M ago
Once you start migrating to the Swift 6 language mode, you'll most likely turn on strict concurrency first. Once you've done this there will be several warings and errors that you'll encounter and these errors can be confusing at times. I'll start by saying that having a solid understanding of actors, sendable, and data races ..read more
Visit website
Setting the Swift Language mode for an SPM Package
Donny Wals Blog
by donnywals
3M ago
When you create a new Swift Package in Xcode 16, the Package.swift contents will look a bit like this: // swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription let package = Package( name: "AppCore", products: [ // Products define the executables and libraries a package ..read more
Visit website
Solving “Task-isolated value of type ‘() async -> Void’ passed as a strongly transferred parameter”
Donny Wals Blog
by donnywals
3M ago
Once you start migrating to the Swift 6 language mode, you'll most likely turn on strict concurrency first. Once you've done this there will be several warings and errors that you'll encounter and these errors can be confusing at times. I'll start by saying that having a solid understanding of actors, sendable, and data races ..read more
Visit website

Follow Donny Wals Blog on FeedSpot

Continue with Google
Continue with Apple
OR