Question about Swift version and SPM package development for server

I've been developing some tools that ought to be useful for Swift on Server folks. Been using Swift 6.2 to take advantage of the latest features.

Is the server community typically able to build and run Swift 6.2 packages that use those newer features?

The packages depending on anything Apple-specific, just Foundation, stdlib, and gnu libiconv so far. There's no networking dependencies, you inject your own, though we do have a default URLSession impl in a separate package that comes with it.

Thanks

Swift is a fast moving target :sweat_smile: To take advantage of the latest features you should use Swift 6.3 IMHO, and Swift 6.4 is just around the corner :slight_smile:

Many developers (including myself) avoid this dependency, as it adds too much size to the resulting binary (I guess this is true only on non-Apple platforms).

1 Like

While there may be folks with legacy support needs, putting something out there that requires 6.2 as a baseline isn't an issue at all. For new projects, it's perfectly acceptable to use the latest available release (6.3.2 at the moment), and as a pattern the community attempts to support back loosely 3 releases - the current release and 2 prior minor releases. So today that's 6.3.*, as well as 6.2 and 6.1.

That said, new projects shouldn't feel obliged to back-support that far - it's completely legit to start with a base set of features and support older release as Swift moves forward.

1 Like

Hmm, OK. Would it be worth it for a Swift-native alternative to Saxon? I'll see if we can get away from Foundation for Linux builds.

Many server packages use FoundationEssentials on Linux. This is basically almost all of Foundation minus the huge internationalization (ICU) part.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
2 Likes

I'm pretty sure I was only using NSDecimalNumber so and then it turned out to be insufficient anyway, because the library I'm writing needs arbitrary length decimal representation. So just wrote our own and ditched Foundation.