I am trying to understand why I cannot get a swift String from my dictionary type of AnyObject. If I do a println(fileCreationDate) it works, but I need an actual string of some kind to work with. So when I try to convert it to an NSString (because it is an object unlike String, a struct) it is nil. Here is what I have:
if let atts = fileManager.attributesOfItemAtPath(fileLocation.path!, error:&err) as? Dictionary<String, AnyObject> {
println(atts)
if let fileCreationDate:AnyObject = atts["NSFileCreationDate"] {
println(fileCreationDate) //prints a date
var mystring:NSString! = fileCreationDate as? NSString
println(mystring) //prints nil
}
Thanks!