How to edit file name in file inspector? - xcode

There are multiple discussions on how to programmatically edit a file name in the file inspector. However, if I simply want to manually change the name of this file in the file navigator.
I have tried clicking on it, then waiting, then clicking again. That seems to work sometimes, but with this xib file I can't seem to get it to work.
This seems to happen intermittently, so I can't provide repeatable steps. I'm looking for an alternative to clicking, waiting, then clicking again guaranteed way to rename a file in the Toolbar/File Navigator.

Like in Finder.app:
Select the file, tap Enter.
Or using the File Inspector (right panel):
Select the file, View/Inspector/File, change the name there.
Like here

Related

How to open containing folder of file in Sublime Text 3 in OSX?

How can I open the containing folder of an open file in Sublime Text 3 in OSX? Prefer an answer that shows me where the menu option is, rather than setting up a command-line.
Some other posts I've searched suggest right-clicking the file and selecting the Open Containing Folder option, but I don't see it on mine...
What you read is correct, but you may be falling afoul of the fact that the context menu that you get when you right click on the file tab is different than the one that you get if you right click in the file itself and, counter-intuitively, the option for opening the containing folder (or copying the path of the file to the clipboard) only appears in the file context menu.
The option you want is Reveal in Finder, which is near the bottom of the menu (note that my menu may be slightly different than yours depending on installed packages):

Rubymine can't recognize ruby file

The file attendance_statistics_controller.rb can't be recognized as a ruby file. All other files can and when i change the name to anything else this one can aswell. It has nothing to do with the length of the filename.
The image on top shows how the ruby file is recognized as a textfile. Changing the name does the trick as shown on the one on the bottom.
Is it a bug in the application or is there something to do about it?
The file name has been registered as being a .txt file
To fix this:
Go to Rubymine | Preferences | Editor | filetypes.
Find the Text file type in the list of recognized filetypes and click it.
Then browse the registered patterns in the box just below and find the file name.
Click it and remove it with the minus(-) button.
Apply changes.
Judging from the file type icon in your screenshot, I guess you have accidentally enabled the Mark as Plain Text feature upon the file. Marking the file as plain text is accessible from the file's context menu and normally it can be used to prevent Rubymine from navigating and completing the code inside the file.
Right click the file and choose the "Mark as Ruby" item to make Rubymine recognize it as ruby code again.

Copy file full path in Xcode

I'm using Perforce for managing our code base. In Perforce, we need to check out a file before we can edit it. When I'm working in Xcode, sometimes I want to know the full path to the working file so that I can check it out in Perforce.
So here is my question:
Is there a shortcut, plugin or some other quick way to copy the full path of a file in Xcode?
What I have known:
I can Command+click on the file tile to show up the full path, but I cannot copy it.
In Visual Studio, we can right click on the file's tab and choose Copy Full Path to achieve this.
In Eclipse, we can Alt/Option + Enter to achieve this.
Update:
Actually my question is about how to achieve the equivalent Copy Full Path feature inside Xcode. Anyway, dragging the file to the terminal is also a very nice workaround.
You can copy it directly out of the File Inspector. The first section ("Identity and Type") of the File Inspector shows information about the selected file, or the file that contains the selected symbol, etc. You have Name, Type, Location, and Full Path. You can select the full path and copy it.
As a shortcut, a triple click on any part of the path will select the entire path. There's also a small icon with a light arrow on a dark background -- clicking that will open a Finder window with the file selected.
You can drag it to a terminal... Easy and fast...
on your editor XCode (you want to get the file path). Press:
Command+Shift+J
xcode will open directory file path on Project Navigator (left side bar)
and then drag-and-drop file from Project Navigator to the terminal. it will give you the directory of the file.
You can use find command to copy file path:
cd myProject
find . -name myCodeFile.cpp
Extending Caleb's answer, here is a graphical demo:
Steps:
Select a filename on the Project navigator from the left side Navigator panel.
Tap on Show File Inspector from the right side Inspectors panel. (marked with red box)
Copy the path from there. (marked with a bigger red box)

Standard way to rename xcode project

After I create a project name for example Proj11, I'd like to change the name to Proj12.
So I use Project->Rename, then the name of the project to Proj12
But the project still contains several folders name Prlj11, and after I change the folders' name, the project can't been loaded.
So what is the standard way to rename my project as well as folder name.
Click on the project folder (blue folder with your app name on the top of the project navigator). Pull up the utilities (right pane), then file inspector. Your project name is there, change it to whatever you want. Then it will ask to save, keep all the files it selected for you selected, then press rename
The best answer I found was on the apple developer site. Imagine that? You can follow the link below, but essentially it is:
1) click on the target in xcode, on the right in "Identify and Type" under name change the name and press the ENTER button on your keyboard.
2)a window will appear confirming the change and what it will change. Once you confirm it will make the changes.
https://developer.apple.com/library/ios/qa/qa1625/_index.html
OR ANOTHER WAY AND EVEN EASIER:
left-click on the name project and rename. As soon as you rename it will ask you if you want to rename:
The folders you see in XCode navigators are not an actual folder/directories, these are virtual folders only to group your files.
And the folders you see in Finder, the path you manually set for the project, you need to rename them manually.

Interface builder file content missing

Am a new bie to IOS development. While working with some sample apps, my mac restarted and after opening xcode i found one interface builder file .xib marked as red. Double click on it shows no content at all. I tried deleting and adding it back from xcode but its not working.
I dont see the file in the project directory too, but when i replace it with old file, it says
an item with same name exists
but its not visible in finder.
Any help would be appreciated.
I am not sure what is a clean solution for this but a quick fix/workaround which worked for me is this:
Along with the error message 'an item with same name exists' you must be getting an id/number which is duplicated.
Open the xib file in any text editor (TextWrangler etc.). It is just an xml file.
Search for that number in the xib. You'll find multiple occurrences of that id.
Replace one of the occurrences with another number and make sure the new number you've added is not a duplicate.
Save this file and open in xcode. The error should be resolved.
Right click on one file in the project and it displays the showinfinder . Then it opens project folder in the finder. Check your file whether it is existing in that or not.

Resources