[swift-dev] [Foundation] Remove/disable availability declarations on OSX? What to do with them?

Karl razielim at gmail.com
Wed May 18 06:44:25 CDT 2016


I’m trying to fix Foundation on OSX (or am I doing something wrong? I was surprised to find it didn’t build)

I’ve run in to a problem, though: swift is telling me that certain APIs are not available:

> Foundation/NSNumberFormatter.swift:19:70: error: 'ordinalStyle' is only available on OS X 10.11 or newer
> internal let kCFNumberFormatterOrdinalStyle = CFNumberFormatterStyle.ordinalStyle
>                                                                      ^
> Foundation/NSNumberFormatter.swift:19:70: note: add @available attribute to enclosing let
> internal let kCFNumberFormatterOrdinalStyle = CFNumberFormatterStyle.ordinalStyle
>                                                                      ^

That’s because the CoreFoundation headers have availability declarations on them.
It obviously doesn’t make sense for us to keep them (and for the resulting swift Foundation project to inherit them), because we’re building a toolchain and defining all of those symbols, not linking against the system versions.

So in order to build CoreFoundation/Foundation for OSX, we’d need to remove these declarations from the headers. Is there any problem with that? Are they synced to anything at Apple HQ?

Thanks

Karl


More information about the swift-dev mailing list