Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift println() not showing autocomplete options while writing code

When I am trying to print using println() function it is not showing autocomplete parameter list in swift. Is there any problem in my Xcode?

like image 419
Nirmal Choudhari Avatar asked Feb 10 '15 10:02

Nirmal Choudhari


3 Answers

Delete user/Library/Developer/Xcode/DerivedData and delete the data of folder(Derive data) and restart Xcode. Should work. If doesn't, restart mac after doing this.

Note: for Xcode 11.7 and maybe later, use the ~/Library/Developer/Xcode/DerivedData/ path.

like image 111
Dhruv Ramani Avatar answered Nov 17 '22 13:11

Dhruv Ramani


Hi I found the reason for this.... As Dhruv mentioned, it only accepts string argument. So we need to convert object to string inline println() function.

For example:

we have integer defined as var age:Int = 24

then we can print this as

println("\(age)")

In this case we will get autocomplete option. On other hand println(age) will print same result as above.

like image 22
Nirmal Choudhari Avatar answered Nov 17 '22 13:11

Nirmal Choudhari


  1. Press cmd + K in your Xcode;
  2. Do context-click on Xcode -> Quit, and the same for Simulator.
  3. Open the project again;
  4. If still doesn't work, you don't need to restart your mac. Write "Int." or some other system type, but not yours that you have issue with and voila!
like image 2
Vladimir Kuzomenskyi Avatar answered Nov 17 '22 13:11

Vladimir Kuzomenskyi