Jake Jake - 1 month ago 12
Swift Question

FileManager.urls returning error

I recently converted my project to Swift 3 and for the most part, it seems okay. However, I receive an error related to FileManager that says:
"Use of instance member 'urls' on type 'FileManager'; did you mean to use a value of type 'FileManager' instead?"

This error makes no sense to me. Here is a picture

static let DocumentsDirectory = FileManager.urls(for: .DocumentDirectory, in: .userDomainMask).first!

Answer

You need to call the urls method on an instance of FileManager, not on the class itself.

Change it to:

FileManager.default.urls(...