Swift 3 NSFileManager Xcode 8 Error: renamed to FileManager

Trying to get the default document directory in Swift 3, but says it has been renamed to FileManager. If the update for FileManager then receives an error: cannot call the value of the non-functional type FileManager

Xcode 8. Swift 3 Beta 4.

using this line of code from FMDB Swift Instructions :

let documents = try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false)
+4
source share
1 answer

URLForDirectory has been renamed to url (for: in: appropriateFor: create :). You should do the following:

let documents = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
+5
source

Source: https://habr.com/ru/post/1650815/


All Articles