URLByAppendingPathComponent: does not mutate an existing NSURL , it creates a new one. From the documentation :
URLByAppendingPathComponent: returns the new URL, the added path to the original URL.
You will need to assign the return value of the method to something. For instance:
let directoryURL = manager.URLForDirectory(.DocumentDirectory, inDomain:.UserDomainMask, appropriateForURL:nil, create:true, error:&error) let docURL = directoryURL.URLByAppendingPathComponent("/RicFile.txt")
Even better would be to use NSURL(string:String, relativeTo:NSURL) :
let docURL = NSURL(string:"RicFile.txt", relativeTo:directoryURL)
source share