Get Application Documents directory in iOS Using Swift

Heres the snippet:


func applicationDocumentsDirectory()->NSString {
        let paths:NSArray = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
        let basePath: AnyObject! = (paths.count > 0) ? paths.objectAtIndex(0) : nil
        return basePath as NSString;
}

Leave a Reply

Your email address will not be published. Required fields are marked *