Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you quickly view a variable type in Xcode and Swift?

For example, if I'm inside a closure and I say,

... { response, data, error in 
...
}

Is there a way for me to view the types of response, data, and error very quickly?

Right now, the only way I can do this without doing a println and building my code is saying

var test = response as! Int

or a ridiculous downcast that's obviously going to display as an error. I look and see it says, "NSURLResponse is not convertible to type int" and that way I know. But this is really inefficient. Is there any way to do this at all in Xcode, even if it isn't specifically a closure and you just want to see the type of the variable.

like image 722
rb612 Avatar asked Mar 15 '23 11:03

rb612


1 Answers

Alt-click on the variable does the thing in my case most of the time.

like image 100
0x416e746f6e Avatar answered Mar 23 '23 00:03

0x416e746f6e