Copy-on-write on APFS

APFS (like many modern file systems but unlike its predecessor HFS+) supports copy-on-write. This means you can logically copy a file – it looks and behaves like a distinct file – but it doesn’t immediately copy the file’s contents on disk – it merely shares them with the original. Only if and as you modify… Read more

Bad API example: FileManager’s url(for:in:appropriateFor:create:)

I find FileManager‘s url(for:in:appropriateFor:create:) to be very unintuitive. It seems to have multiple, largely-orthogonal functions. It can provide paths to common folders (albeit badly). It can create temporary folders. It can locate volume-specific bins (Trash folders). It is an example of bad API design. Specifically, regarding cohesion: the principle that an API should have one… Read more