Value integrity in Swift
Oct 14, 2021, 8:00 PM
In the context of programming, integrity means making sure that a piece of data follows the correct business rules. In this excellent post, Luis Recuenco analyzes different alternatives to ensuring value integrity in Swift. Luis first...
Performance: Actor vs queue vs lock
Oct 10, 2021, 8:00 PM
Swift 5.5's Actor type allows only one task to access their mutable state at a time. This provides one method of implementing synchronization, which prevents threads from accessing shared data at the same time. In this short but...
Swift 5.5 Released!
Oct 2, 2021, 8:00 PM
Swift 5.5 is officially released, and despite only being a minor release - according to semantic versioning - it includes lots of new language capabilities. In this post to the official Swift blog, Ted Kremenek of the Swift Core Team...
Swift concurrency back deployment
Sep 23, 2021, 8:00 PM
Doug Gregor, a member of the Swift team at Apple, recently opened a PR that adds an option to build the Swift 5.5 Concurrency libraries for older versions of macOS/iOS. This PR generated a lot of interest amongst the Swift community, with...
The difference between Thread.sleep() and Task.sleep()
Sep 18, 2021, 8:00 PM
Swift 5.5 introduces tasks, which represent a unit of work that can be run asynchronously. In this post, Marin Todorov compares Thread.sleep() and Task.sleep(), using this comparison to help explain some of the benefits of Swift's new...
Command Pattern in real-life
Sep 13, 2021, 8:00 PM
The Command design pattern turns a request into a stand-alone object that contains all information about the request. In this short post, Michael Abadi Santoso shows us how he used the command pattern to provide an abstract implementation...
Pitching Optional Throws in Swift
Sep 9, 2021, 8:00 PM
Swift provides support for throwing, catching, and propagating errors at runtime. When a function throws, callers are required to handle any possible errors. This Swift evolution pitch from Michael Verges proposes optional throws, allowing...
Why Conditional View Modifiers are a Bad Idea
Sep 8, 2021, 8:00 PM
When applied to a SwiftUI View, a ViewModifier produces a different version of the original value. To address the need to apply a modifier to a View only when a condition holds true, many developers implement some version of a conditional...
Open Sourcing: Custom Dump
Sep 2, 2021, 8:00 PM
Debugging relies upon the ability to dump (print, log, etc.) data structures into human-readable strings. Swift provides a built-in tool for this called dump. However, its usability is limited due to the format of the output. To address...
My favorite new Swift API from iOS 15
Sep 2, 2021, 8:00 PM
In this post, Paul Hudson from Hacking With Swift shares his favorite new Swift API from iOS 15. This new API looks deceptively simple, but internally it's built on effectful read-only properties and AsyncSequence, both of which are...
Add an option to build the concurrency library for back deployment
Sep 2, 2021, 8:00 PM
Implemented by Doug Gregor, a member of the Swift team at Apple, this unexpected pull request adds an option to build the new Swift Concurrency libraries for older versions of macOS/iOS. These libraries can then be embedded in targets...
Open Sourcing Identified Collections
Aug 28, 2021, 8:00 PM
Most applications involve working with collections of data in some form, and it's common to model such data as a standard Array. However, as applications grow more complex, the limitations of Arrays might start to cause problems....
Using ‘@unknown default’ within switch statements
Aug 12, 2021, 8:00 PM
In Swift 4.2, enums defined in the standard library are either frozen or non-frozen. A frozen enum is one that will never get a new case. In this post, John Sundell shows us how to handle non-frozen enums in Switch statements.
SwiftUI - Router Pattern
Aug 10, 2021, 8:00 PM
The coordinator pattern is a pattern often used when developing iOS apps using UIKit. It enables developers to separate navigation logic from view logic, resulting in reusable and testable code. In this post, David Gary Wood demonstrates...
Using tuples to Complex Sorting Operations in Swift
Aug 9, 2021, 8:00 PM
The Swift standard library contains several overloads of the < comparison operator used to compare tuples of various sizes. In this post, Leonardo Maia Pugliese demonstrates how to use these overloads to implement complex sorting...
Backporting new features with @_alwaysEmitIntoClient
Aug 5, 2021, 8:00 PM
Swift attributes provide additional information about a declaration or type. In this post, Federico Zanetello explains how SwiftUI uses the @_alwaysEmitIntoClient attribute to make new features available on older OS versions.
Throwing and asynchronous Swift properties
Jul 29, 2021, 8:00 PM
Computed properties that only define a get accessor are read-only. When they also have associated behavior, an effect, they are known as effectful read-only properties. In this post, John Sundell demonstrates how such properties can throw...
Copy-On-Assignment vs. Copy-On-Write in Swift
Jul 28, 2021, 8:00 PM
Copy-on-write is a resource-management technique used to efficiently copy data, such as a Swift struct. It involves delaying the copy operation of the data until it's needed, usually when some part of the data is modified. In this post,...
Dependency Injection in Swift using latest Swift features
Jul 27, 2021, 8:00 PM
Dependency injection is a commonly-used technique to enable simplified testing and code reuse. In this post, Antoine Van Der Lee shows us how to avoid using third-party dependency injection libraries, providing his implementation of...
5 Complex Algorithms Simplified Using Swift’s Higher-Order Functions
Jul 26, 2021, 8:00 PM
Higher-order functions accept one or more functions as arguments, return a function, or do both. Swift's higher-order functions, such as map and reduce, enable us to implement complex algorithms in a simplified manner. In this post, Lee...
Bridge from Combine to AsyncSequence - the plan (p. 1)
Jul 25, 2021, 8:00 PM
Despite only being released with iOS 13, it seems like Apple's Combine framework - used for handling asynchronous events - has been overshadowed by the new Swift concurrency model. In this post, Marin Todorov looks at both of these...
Xcode DocC - Getting Started
Jul 24, 2021, 8:00 PM
Available in Xcode 13, the DocC documentation compiler converts Markdown-based text into developer documentation for Swift frameworks and packages and displays it in the Xcode documentation window. In this post, Keith Harrison runs through...
Swift actors tutorial - a beginner's guide to thread safe concurrency
Jul 24, 2021, 8:00 PM
Swift 5.5's Actor type allows only one task at a time to access its mutable state, making it safe for use by concurrently executing tasks. Here, Tibor Bödecs from The Swift Dev teaches us how to use this new type to protect our...
Fixing a hard-to-find bug in Dark Mode
Jul 23, 2021, 8:00 PM
The worst kind of software bugs are inconsistent: sometimes they occur, sometimes they don't. In this post, Jesse Squires tracks down such a bug, and explains how he implemented the fix.
Cooperative Task Cancellation
Jul 23, 2021, 8:00 PM
This post from Peter Friese from his SwiftUI Concurrency Essentials series focuses on the topic of cooperative task cancellation. Peter provides a SwiftUI example demonstrating why cancellation is important, and shows us how to use...
The importance of cooperative cancellation
Jul 18, 2021, 8:00 PM
In the context of concurrent programming, cooperative cancellation refers to a system where parent tasks and child tasks need to cooperate to ensure the correct cancellation of asynchronous tasks. The new Swift concurrency model supports...
Advanced SwiftUI Animations — Part 4: TimelineView
Jul 13, 2021, 8:00 PM
Announced at WWDC 21, SwiftUI's TimelineView is a view that updates according to a provided schedule. In this post, part of a series of posts on advanced SwiftUI animations, Javier explores this new view in detail. Despite it being two...
Table and Collection View Cells Reload Improvements in iOS 15
Jul 8, 2021, 8:00 PM
iOS 15 includes several new APIs that help to make UICollectionViews and UITableViews more performant. In this post, Lee Kah Seng from Swift Senpai demonstrates how to use these APIs via a fully working sample project.
iOS 15: Notable UIKit Additions
Jul 1, 2021, 8:00 PM
Despite SwiftUI stealing the limelight in recent years, UIKit still has a place in Apple's heart. With iOS 15, UIKit gains a host of new capabilities and APIs, and in this post, Jordan Morgan provides instructions on how to use some of...
Async/Await and the Future of Combine
Jun 29, 2021, 8:00 PM
With the debut of the new Swift Concurrency model at WWWDC this year, it was noticeable how some of its language features appear to be replacements for some of the Combine frameworks features. In this honest post on the topic, Ben...
Jun 24, 2021, 8:00 PM
A lot of the sessions at this years' WWDC related to the new concurrency model in Swift. A central part of this model is the concept of structured concurrency, which enables concurrent execution of asynchronous code. The language features...
AsyncImage in SwiftUI
Jun 19, 2021, 8:00 PM
New in iOS 15 is AsyncImage, a new SwiftUI View for fetching and displaying remote images from a URL. Here, Gabriel Theodoropoulos demonstrates how to use this new type, and highlights some of its pros and cons.