6

I have a virtual Mac running and want to code a bit in Xcode. My keyboard has characters as { and [ available by using Alt-Gr. In my virtual Mac, using the same keyboard combinations gives me a different output.

  • Alt-Gr + 9 produces a capital ç instead of {
  • Alt-Gr + ^ produces ô instead of [

I managed to solve this for some programs by using the 'Use symbol and text substitution' option under Language & Text - Text in the system settings. This is working fine in TextEdit, Safari, ..., but not in Xcode. Xcode seems to ignore the symbol and text substitution.

Any ideas how to fix this? Or maybe another workaround? Any help is appreciated, because this issue is really slowing down my programming speed.

2
  • Not a programming question. Please ask on superuser.SE or apple.SE. Commented Jun 30, 2012 at 12:21
  • 3
    IDE questions are on-topic on SO. Commented Jul 1, 2012 at 23:44

2 Answers 2

5

Xcode, the text substitutions are not enabled by default. To enable go to Xcode -> Edit -> Format -> Substitutions -> Text Replacement (Enable this)

enter image description here enter image description here enter image description here

Hope this helps!

Edit: As Senseful mentioned its better to use Code Snippets. This is a link explaining how to use code snippets Creating Custom Code Snippets and this. Hope it helps!

Sign up to request clarification or add additional context in comments.

4 Comments

This seems to not be very consistent in Xcode. Sometimes it works, sometimes it doesn't. It works more often in comments than actual code. A more robust solution is the Code Snippet Library feature of Xcode.
I guess this is deliberate so that it doesn't keep autocorrecting strange spellings in code, which could get annoying. Code snippets it is!
In Xcode 11, all the options under "Substitutions" are greyed out → I don't see any way of enabling "Text Replacement". Does anyone know of a solution? My use case is using these text replacements, e.g. →, in a wide variety of logging and documentation, so snippets are no solution.
I have the same problem. I did first have substitutions active. I tested smart quotes and now the whole menu is greyed out, no way to revert !
0

Since this is not consistent in Xcode (e.g. I can't even enable the option on Xcode 9), I'd recommend using an Xcode Snippet instead.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.