I often find myself having to create a temporary file in code for some operation, and every time it turns into a small nuisance: I have to find a suitable temp directory, make sure I give the file a unique name, and must not forget to delete the file after Iām done with it.
Source: A helper for working with temporary files in Swift ā Ole Begemann