Pitch: Public initializer to make `URLResourceValues` from `[URLResourceKey : Any]`

Any reason not to do this? It just seems a bit silly to be able to go one direction via the allValues property, but not to be able to go the other direction, and being able to convert the other way would help with certain situations when crossing the Swift/ObjC boundary.

URLResourceValues is part of Foundation, which is an Apple proprietary framework (with an open-source counterpart (swift-corelibs-foundation) that tracks the API of the proprietary framework). The API is not subject to Swift Evolution except where it touches on Swift standard library or compiler concerns; you can file a bug via Feedback Assistant.

1 Like

URLResourceValues is part of Foundation, which is an Apple proprietary framework (with an open-source counterpart (swift-corelibs-foundation) that tracks the API of the proprietary framework).

To clarify, the functionality I am referring to is in that open-source counterpart, which is linked from the swift.org "Sources" page: Swift.org - Source Code

Specifically, it's here (and here, depending on whether you want the overlay or the open-source Foundation which is available on Linux). In both cases, the file says

// This source file is part of the Swift.org open source project

on the top.

The swift-corelibs-foundation repository is indeed under github.com/apple, but then, so is the Swift repository itself.

I could just open a PR against those two files and it would likely take less than 5 minutes to do, but since the files are part of the Swift project, and since there have been numerous previous SE proposals related to the Foundation overlay in the past, I figured it would be considered gauche to do so before going through the SE process. :person_shrugging:

The overlay and swift-corelibs-foundation are open source, and they do take PRs, but they are not subject to the Swift Evolution process except as it relates to the standard library and compiler, and it's Apple that decides the public APIs. Just because the code is part of the same open source repository doesn't mean that it's governed by the same processes; you can open a PR, but the addition of public API would not be accepted without an Apple-internal review that you can't trigger.