In this podcast, I discuss reliability and performance with different concurrency & thread safety options on the Apple platforms.
A Swift package for rapid development using a collection of micro extensions for Standard Library, Foundation, and more. Includes documentation and unit tests. Cross-platform targets for macOS, iOS, watchOS, tvOS, and iPadOS and were used across various apps for providing a central and extensible API.
Delegation is a simple and powerful pattern. However, closures are more Swifty and scales better. Let’s convert delegates to closures!
Thread-safe resources in Swift can be achieved with Grand Central Dispatch. Using a concurrent queue and the barrier flag, reads can occur in parallel while writes are given mutual exclusivity for safety and optimization.
GCD is not for thread-unsafe shared resources since it does not guarantee the same thread will be used for the queue. We can use the threads API with a bit of sugar syntax.