Thread safety with Mutex in Swift 6

Thread safety with Mutex in Swift 6

With Xcode 16/Swift 6, Apple introduced the Synchronization framework, bringing to the table more ways to ensure thread safety in our software.

Today we will be exploring the Mutex struct, seeing how it can be used to prevent crashes and undefined behaviour due to simultaneous reads & writes to shared mutable data. Will also discuss how a similar type can be implemented to support older iOS versions.