Simple question - how can you view the values of variables in Xcode\'s watch window when using Swift?
Here\'s an example, see how mdn has the value 2067134273 yet its no
Xcode 6 beta 4 shows values of variables of NSString
and NSString?
types:
Nevertheless if you may need to see details for some other type even from some third-party framework that you cannot alter then you can implement debugQuickLookObject
method and return custom description. In case of third-party lib you should wrap it in extension. For NSString
it will be:
extension NSString {
func debugQuickLookObject() -> AnyObject {
return self
// return "Here is debug value: \(self)"
}
}
To preview it, just select the item in watch window and hit spacebar
: