[swift-corelibs-dev] Why URL doesn't have fileReferenceURL and isFileReferenceURL, but NSURL has?

Ole Begemann ole at oleb.net
Tue Dec 6 05:56:18 CST 2016


> The question is the subject, but anyway I’ll repeat it here: Why URL
> doesn't have fileReferenceURL and isFileReferenceURL, but NSURL has? Is
> it by design? If it’s a bug I can create an issue in https://bugs.swift.org.

It seems this is intentional, see SR-2728: 
https://bugs.swift.org/browse/SR-2728.

Tony Parker wrote in a comment there:

"Note that it is expected behavior that `struct URL` does not support 
file reference URLs.

The unfortunate part here is that we don't have a mechanism to keep 
`NSURL.fileReferenceURL` from being imported as returning `struct URL` 
instead of `NSURL`. We probably need to add an ObjC thunk in the overlay 
and mark the API as `NS_REFINED_FOR_SWIFT` in the NSURL.h header. 
However, that would be a source breaking change."


More information about the swift-corelibs-dev mailing list