XCode 13 unable to remove code lines after deleting Derived data - ios

I deleted Derived data of project and after that I can't remove any line of code in the project. The moment I delete any character in function, XCode 13 is duplicating that line as seen in the below image.
And I can't delete even a comment. The code doesn't even build now. What do I do?
A big chunk of commented code I tried to delete, it deletes but then shows that deleted code again upwards in another function.

Your screenshot is showing the inline comparison view, which shows version control changes inline in Xcode's editor. The inline comparison view is confusing if you're used to the side by side comparison view. The top line of code shows the old version of the code. The second line shows the current version of the code. When you delete code the deleted code remains when the inline comparison view is on because the deleted code is the old version of the code.
If you don't like the inline comparison view, you can get rid of it using the buttons on the right side of the document tab list, which is above the editor and below the project window toolbar.
Clicking the left (blue) button in the screenshot turns off showing version control changes in the editor. Clicking the middle button and choosing Side by Side Comparison will show the changes in two separate editors side by side.

Related

Xcode Record UI test - How to remove XCTestCase auto generated code drop downs

See the attached screen shot, when generating Xcode UI Test code using the record button, the generated code contains annoying drop downs that I cannot figure out how to remove.
When the popover is not displayed, then double-clicking on the code removes the menu tokens. It will now no longer appear in version control.
If the popover has appeared you need to select a value or otherwise dismiss the popover before the double-clicking works.
If there was a bug in earlier versions of Xcode, it is working at least in Xcode 10.3 (and possibly earlier versions)
I don't think there's any built-in function in Xcode to do this, so the best I can come up with is a regex that you can use to search and replace:
/\*#START_MENU_TOKEN#\*/|/\*\[.+\]#END_MENU_TOKEN#\*/
Interestingly, this works in the Xcode editor too, even if the actual texts START_MENU_TOKEN and so on are converted into dropdowns and as such invisible.

Assistant editor(Xcode 7.3) always showing interface file in storyboard , even when I choose manually

Even after deleting derived data many times, and trying other things, I am still facing this problem. Can you help me?
You can try using the shortcut key instead, to open up the assistant editor.
Shortcut key: -
option + click on the file which you want to open up in the assistant editor
Guys I just stop dealing with this problem by changing the settings in xcode 9.2. And now i use Navigation Pane.
Here is how it works :
Ok now if you go to xcode -> preferences -> navigation
and Choose the "Uses Focused Editor" as in the picture below.
Now you can manually select inside the Navigation Pane.
Just click whichever page you would like to change and select in the Navigation Pane.
Here is a few screenshots :
Pictures shows code files but it works with everything you can click in the Navigation Pane.
Try to drag and drop file from the Project Navigator into the path of the Assistant Editor as temporary fix.
You also can click on this icon to bring recent files.
Try to clean your project, clean Build Folder, restart Xcode.
Make sure the view controller in your Storyboard has correct custom class name.
I think I know the problem you're having. I experience it too, but it's intermittent. Sometimes clicking Manual shows me the entire project folder and I can select the editable classes, but other times it only shows the interface versions of them, which aren't editable and cannot have IBOutlets dragged to them (you can tell b/c it'll say internal class and has less code). I have noticed that if I toggle back and forth between Automatic and Manual, I can usually get the editable class to appear. I also will toggle the assistant editor off, select a different View Controller or two on the storyboard, then go back to my original one, turn the Assistant Editor back on, and it starts working again.
There are other discussions of it here, here, and here. This suggestion of turning off indexing sounds intriguing and worth a try if the problem keeps reappearing. UPDATE: This trick with hitting the + and opening a 2nd file, then closing the interface file, worked great when I tried it just now.
Here are pics of how the Automatic side shows the actual file when the Manual side only shows the interface, which says internal next to class:

How i can see in-brower version of XCode reference? Wanna see list of methods

I'm very like lists of methods in web version of reference.
But in Xcode I can't (at least by default) see this beautiful lists.
Can I change style of Xcode built-in reference? Make it show me in-browser version?
in-browser
in-xcode
Well you can't make "it show me in-browser version", but you can get a list down the side:
Note that the fourth icon in the title bar is selected to get the contents.
To open all the subsections you click on the first disclosure triangle, the NSWindowCntroller line, that will collapse everything. Then option-click on it and everything will be expanded.
The divider between the contents list and the content can be dragged, so you can widen the contents list to see the full method names if you wish.
You can click on any entry to jump to that section, but it might not be smooth or fast – you will probably see the Xcode viewer re-parsing the source file! Older versions of Xcode were better, it's since been "improved"...
HTH

Xcode 5.1 method search only allows one character?

I've recently upgraded to Xcode 5.1 and I'm experiencing the most annoying bug. The instant search or method search dialog that allows you to search the methods on the given source file you are looking at isn't allowing me to enter more than one character. I have large source files and I tend to rely on that a lot. Any idea why this might be happening. I've tried re-installing Xcode (simply be dragging it in the trash).
You can find the search field I'm talking about by clicking the method as shown in the screenshot and simply typing something.
When I type the character gets replaced with the last letter entered.
(This one's just informational: I don't think it will fit in a comment, and want to report on what suggestions worked and didn't.)
I ran into this same problem. I accidentally typed some other key combo when trying to do Ctrl+6 to open the Document Items dropdown, and it was all out of whack after that.
As clance_911 mentioned, the filtering would work after clicking in the search box. So for example, to filter for "init", I could hit Ctrl+6 to open the Document Items, type "i" to start filtering (but then any subsequent letters would replace the i), click into the search text box, and continue typing the "nit". This works, but it's a pain.
As Moze pointed out, this seems to be specific to external displays. Sure enough, it worked fine on my MacBook display, but if I moved Xcode over to the external display, it stopped working. In my case, dragging the menu bar in the display Arrangements settings (to make the external monitor the main display) did solve the problem: the filter worked correctly with Xcode in either window. Sorry, Etienne :-(
The other solution that worked for me was simply closing the MacBook: use it in clamshell mode with only the external display. This is my normal setup anyway, but I know that's not ideal for everyone.
It happens if Xcode is open in external display that is not main display.
To fix it, open display setting's Arrangement tab and drag menu bar to display that you are working on.

Xcode editor autoscrolls to the top of the page

Lately I have been experiencing strange behaviour in Xcode, after some period of coding it begins to autoscroll to the top of the current code page, and it wont let me scroll, if I am persistent in trying to scroll, my whole code disappears and the whole thing looks like this:
I am currently using Xcode 4.6.3 but the issue is also present in v. >= 5.0. Has anybody came across this type of problem. Please help, it is driving me mad.
EDIT:
I managed to get my code back by hiding and showing right panel in xCode, it seams to rebuilt the page, if U see in left corner of my screenshot there is a true line number but it is the only line in my editor, until I hide/show right panel then the code returns, after that if I continue scrolling it disappears again...
EDIT 2: Ok now I experienced another thing, my code just breaks, it turns in a bunch of letters scrambled across the screen, like code editor forgets all formatting and line breaks and just shows the code in some way. Again hide/show of right panel fixes the problem but just for a while.
The problem occurs when I make a syntax error or when intellisense offers me some autocomplete code and I don't complete that line in that exact moment. After that it's all down the hill. I'll try to capture the broken code and I'll post it when I do...
EDIT 3: I managed to capture the broken code so that you can see what I am up against:

Resources