There is a little mistake in getting applicationDocumentsDirectory constant in Functions.swift. In the book there is a version for the Swift 2. Correct version for the Swift 3 will be like this:
let applicationDocumentsDirectory: URL = {
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
return paths[0]
}()
urls(for: in:) and urls( for directory: in domainMask:) are the same thing. However, the second one is used only by Apple in the source code of FileManager. When you want to use this method you should use the first one, without the internal labels.
By definition, FileManager.default.urls(for: in:) returns an array of urls. However, tested with .allDomainMasks but still just returned an array of one url. When would it actually return multiple urls? Thanks.