I load a value from a dictionary in a plist but when I print it to the console, it prints: Optional(Monday Title) rather than just "Monday Title".
How can I get rid of the Optional() of my value when printing?
var plistPath = NSBundle.mainBundle().pathForResource("days", ofType: "plist")
var plistArray = NSArray(contentsOfFile: plistPath!) as NSArray!
for obj: AnyObject in plistArray {
if var dicInfo = obj as? NSDictionary {
let todayTitle: AnyObject? = dicInfo.valueForKey("Title")
println(todayTitle)
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…