[swift-evolution] (core library) modern URL types

Charles Srstka cocoadev at charlessoft.com
Mon Aug 21 11:33:42 CDT 2017

> On Aug 21, 2017, at 11:29 AM, Robert Bennett via swift-evolution <swift-evolution at swift.org> wrote:
> If value-based generics become a thing, then you’ll be able to specify a URL type with URL<.file> which would pretty much solve this problem.

And then you could make APIs that are specific to certain schemes, and maybe even have file references working again.

extension URL where Scheme == .file {
	var path: String { … } // non-optional

extension URL where Scheme == .fileReference {
	var path: String? { … } // optional


More information about the swift-evolution mailing list