Hello,
When I copy code from Xcode into Apple Notes comments are inserted into the pasted text. For example:
Code in Xcode:
ZStack{
RoundedRectangle(cornerRadius: 5)
.stroke(Color.red)
.frame(height: 40)
HStack{
Image(systemName: “magnifyingglass”)
.foregroundColor.blue)
//this is referencing the textfield
configuration
}
}
Here is the pasted code:
ZStack{
RoundedRectangle(cornerRadius: 5)
.stroke(Color.red)
.frame(height: 40)
HStack{
Image(systemName: “magnifyingglass”)
.foregroundColor(/@START_MENU_TOKEN@/.blue/@END_MENU_TOKEN@/)
//this is referencing the textfield
configuration
}
}
Is there a way to paste without the comments inserted?
Thanks
Monty
Those are tokens Xcode uses to mark where you should fill in information. You can select them in Xcode and hit Return to accept the default value or type in a different value. Once you do that, those tokens will no longer show up when you copy/paste.
The fields are filled in.
Here is a simpler example:
This is what the code looks like in Xcode:
.foregroundColor(.blue)
I select it and copy to the clipboard.
When I paste it into this forum this is what is pasted" .foregroundColor(/@START_MENU_TOKEN@/.blue/@END_MENU_TOKEN@/)
What roosterboy
is getting at is that when you add a modifier there is some default data that appears that you either have to change or if the value suits you then select it with your cursor and then press the return or enter key to accept that value.
For example:
The cursor is on .blue
so press return and the result it as follows:

I get it!!!
Sometimes I have to be told things many times before it sinks in!
Thanks Chris and Roosterboy!