4 ms·
In the Swift library documentation itself, hopefully a Swift person can tell me: What is the significance of the list of Apple platforms given? For example the
by tialaramex 3y ago
In the Swift library documentation itself, hopefully a Swift person can tell me: What is the significance of the list of Apple platforms given? For example the Clock protocol shows iOS 16.0+ among others.
I can imagine that e.g. ContinuousClock is platform specific - any particular system may or may not be able to present a clock which exhibits change despite being asleep for a while and so to the extent Apple claim Swift isn't an Apple-only language, ContinuousClock might nevertheless have platform requirements.
But the protocol seems free from such a constraint. I can write this protocol for some arbitrary hardware which has no concept of time, I can't implement it, but I can easily write the protocol down, and yet here it is iOS 16.0+ anyway.
- Daedren 3y agoApple just doesn't backport APIs, it's a very very very rare occurence when it happens. It was introduced last year alongside iOS 16 so you require the latest OS, it's the norm really.
- tialaramex 3y agoI guess maybe I didn't explain myself well. Swift is supposedly a cross platform language. This "protocol" unlike the specific clocks certainly seems like something you could equally well provide on say, Linux. But, it's documented as requiring (among others) iOS 16.0+ Maybe there's a separate view onto this documentation if you care about non-Apple platforms? Or maybe there's just an entirely different standard library for everybody else?
- lukeh 3y agoSame standard library (Foundation has some differences, that's another story). But the documentation on Apple's website only covers their own platforms.
- rockbruno 3y agoThe standard library stopped being bundled with Swift apps when ABI stability was achieved. They are now provided as dynamic libraries alongside OS releases, so you can only use Swift features that match the library version for a particular OS version.
- beeboobaa3 3y agoYikes. So after bundling their development tools with their operating system they are now also bundling some language's stdlib with the operating system? Gotta get them fingers in all of the pies, I guess.
- KerrAvon 3y agoEvery Unix and most Unixlikes have always done this. It’s standard practice in that world.
- beeboobaa3 3y agoWhich distro ships the go standard library? Also unixes let the sysadmin install additional libraries. How do I `apt install libswift2` on an iPhone?
- saagarjha 3y agohttp://cydia.saurik.com/ http://cydia.saurik.com/
- beeboobaa3 3y agoHow do I install this on my iPhone while retaining support from Apple?
- MBCook 3y ago> they are now also bundling some language's stdlib with the operating system much like libc, isn’t it? Apple writes tons of their own software in Swift and the number keeps going up. They’re trying to move more and more of the system to. It’s going to be loaded and in every system whether a user uses it or not. No different from the objective-C runtime.
- jackjeff 3y agoAbsolutely agree. On Windows the equivalent would be MSVCRT which is sometimes shipped with the OS and sometimes not (depending on the versions involved). Sometimes you even need to worry about the CRT dependency with higher level languages because their “standard librairies” depend on the CRT. So if you see that being installed with Java or C# or Unity, now you know why.
- pdpi 3y agoAccording to their changelog[0], Clock was added to the standard library with Swift 5.7, which shipped in 2022, at the same time as iOS 16. It looks like static linking by default was approved[1] but development stalled[2]. I expect that it's as simple as that: It's supported on iOS 16+ because it's dynamically linked by default, against a system-wide version of the standard library. You can probably try to statically link newer versions on old OS versions, or maybe ship a newer version of the standard library and dynamically link against that, but I have no idea how well those paths are supported. 0. https://github.com/apple/swift/blob/main/CHANGELOG.md https://github.com/apple/swift/blob/main/CHANGELOG.md 1. https://github.com/apple/swift-evolution/blob/main/proposals/0342-static-link-runtime-libraries-by-default-on-supported-platforms.md https://github.com/apple/swift-evolution/blob/main/proposals... 2. https://github.com/apple/swift-package-manager/pull/3905 https://github.com/apple/swift-package-manager/pull/3905