Sqlite file path in Xcode 8 ?

Where can I find the sqlite database file path when storing data using core data in Xcode 8 ? Since the application documents directory function was removed in the app delegate in Xcode 8, is there a way to find the file path for sqlite database ? Usually I use the following code to find the directory


let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)


How do we find out the sqlite path in Xcode 8 ?

Ok spent hours researching this... use this code in your app delegate



lazy var applicationDocumentsDirectory: NSURL = {

/

let urls = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)

return urls[urls.count-1] as NSURL

}()


then in you didFinishLaunchingWithOptions


print(self.applicationDocumentsDirectory)



When you get your path, it should be in your Library folder.


Apple should make it easier to acccess this. People access this file all the time:)

Xcode 8

let directory = NSPersistentContainer.defaultDirectoryURL()

let url = directory.appendingPathComponent(yourModel + ".sqlite")

print url


Mixing Xcode 7 & 8;

func getDocumentsDirectory()-> URL { let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask) let documentsDirectory = paths[0] return documentsDirectory }


print documentsDirectory

I have used both, I like 8

Sqlite file path in Xcode 8 ?
 
 
Q