That would be nice, wouldn't it?
Unfortunately, URL.appendingPathComponent
just forwards to NSURL.appendingPathComponent
, which makes blocking calls to the filesystem. So does URL(fileURLWithPath:)
(here).
But I do agree that a URL type should be a pure model type, and that the results of URL manipulation should never depend on the state of the filesystem. That's why I also objected to the recent URL.lines
async addition, which continues this trend of blurred lines -- you can request data (and text lines) using a URL, but the URL API should be kept pure and focussed on its task of... basically, string manipulation.
It would be impolite to link it here, but there are alternatives if you'd prefer a true model type for URLs.