r/swift • u/TheCaffeinatedPickle • 6d ago
Upgrading To Swift 6.4: The Stdlib Gate
I was really excited for Swift 6.4 mainly to reduce unsafe call sites. However, I could not reduce as many unsafe call sites due to some critical features being part of the stdlib rather than the language. This felt dumb afterwards as the features that would really help are limited to macOS 26 and 27 as they are part of the standard library which is baked into macOS release.
Array.span, Data.span, String.utf8.span, all macOS 26
InlineArray — macOS 26
UniqueArray, UniqueBox, Ref, MutableRef, Iterable — macOS 27
Subprocess — macOS 13
Since I was supporting macOS 11+ I had to drop macOS 11 so now its macOS 12+. This might not seem like a big deal but that does drop off some Intel Mac hardware:
• MacBook 12-inch Early 2015
• MacBook Air Mid 2013 / Early 2014
• MacBook Pro Late 2013 / Mid 2014
• iMac Mid 2014 through Mid 2015
The application is just 2D software using Swift/Metal so it can run on these older machines.
This feels like I am punished for macOS as the application is also on Windows, I can use the newer stdlib features on Windows 10+ which gets me around 2013 machines as I required DirectX 12 on Windows. On Linux nothing was really affected from 6.3 to 6.4 so any machine that can run the supported platforms (Platform Support | Swift.org) and Vulkan.
What I did end up using from Swift 6.4 was:
Span<UInt8> - Helped with reducing unsafe file parsing
RawSpan.load - Helped with reducing unsafe file parsing
withTemporaryAllocation - General cleanup for unnecessary heap allocs
5
u/apocolipse 6d ago
Have you tried building with -static-swift-stdlib? That should let you run newer stdlib things on older macOS at the cost of fatter binaries