I'm using #pragma mark - Description all over my source code to use with the XCode4 Jump Bar. This is a pretty handy feature all most you already know.
But right now I'm having a big .h/.m file containing all my business logic classes (RMCategory, RMProduct, RMCountry, RMAddres, ...) and my jump list is starting to look overcrowded.
Is there any known way to disable some items in the jump list? Specifically, I'm looking into hiding the ivars from the .h jumplist. Is there some directive like #pragma hide ivars?
I've been trying to search other supported #pragmas specific to XCode but haven't been able to found anything apart from the classic // TODO, // FIXME et al.
OK, so I've been told by Apple staff at their dev forums that this was currently impossible. I've filed an enhancement proposal there.
Related
I'm updating some legacy code, because of my unfamiliarity to it, Its very difficult to find structures, especially if I step away for a week for other projects.
To alleviate this problem I've gone back to my old-school roots and started adding ascii text-art as comments above sections of code, using this tool:
http://patorjk.com/software/taag/#p=display&h=3&v=1&f=Big%20Money-ne&t=Reveal%0ACheck
This allows me to see via my MiniMap the titles of functions or sections of code I might need to come back to
The Thought then occured.. well surely someone else has this problem, and since VSCode seems to be written by the community, maybe someone has already written a plugin that would search the code for function titles (like Javadocs?) and display the title in a readable size?
If not, would it be easily coded? i.e. is the minimap just a very shrunk down copy(not easy) or is it structured and can be parsed and tweaked?
As long as your language plugin supports it, you can use cmd + shift + o to go to function definition.
All functions should also be listed in the Side Bar under "Outline"
I've been exploring various text editor solutions for Mac OS X recently, and I've noticed that some editors, namely Xcode, Smultron and CodeRunner, show the same behavior with bracket matching, which makes the matching bracket exhibit a small yellow popping animation that looked exactly the same throughout the editors. This made me think about whether there is a unified Cocoa API for code views that is being used. I have looked for something like that but I haven't found anything. Can someone enlighten me?
There is no unified Cocoa API for code views, no, or at least not that I am aware of. The yellow popping animation is just due to the Cocoa method -[NSTextView showFindIndicatorForRange:], which lots of different code editors use for producing that sort of effect. However, if you search stackoverflow you'll find some examples of how to do syntax coloring, bracket matching, etc. You might also find the source code in this project useful: https://github.com/MesserLab/SLiM. (Which happens to be a project I work on.)
Does Xcode have a way to show the caller function of a method? I want to know all of the calling functions of a method in a class. A solution would be to find the method in the project, but sometimes different classes have methods with the same name - That could find us a method we're not looking for..
Many other IDEs have this capability, such as Visual C++ 2003/2005/2008,Eclipse ...
Can you do this in XCode?
Xcode 4.4 intrudced this functionality:
New Features in Xcode 4.4 (Scroll down to 'Find and Search Additions')
Move your cursor on top of the function you are interested in
Open the Assistant editor(⌃ +⌘+Enter)
On the top of the assistant editor, Select 'Callers'
You will see a list of all the function that's calling your function
Not the as effective as other IDEs, but does the job.
Yes. Set a breakpoint inside your method, then when it breaks, there are two spots to see a stack. First is in Xcode's "console" area (usually the bottom middle), there is a top-bar which may not immediately appear to be navigable, but it is a select-style UI control which has the entire stack in it. Selecting a different level shows you that scope's variables, etc. and pops your editor to that exact file (where you can mouse-over variables to see their in-memory real-time values). Second is in the left-hand area (where you normally browse files). There is another tab there (besides the file browser) for exactly this purpose. There is a slider at the bottom which controls how many "steps" in the stack you see; clicking on one has a similar affect.
For simple refactoring such as method re-naming, you can use the contextual-menu when you right-click a selected method-name, and Xcode will replace all identical selectors in your project. However, this does not address what you mentioned about different classes having methods with the same signature. It does, however, give you a very nice interface for reviewing the changes in-context and easily accepting or rejecting them one at a time.
It might be noted, however, that changing method signatures often may be a sign of poor design, and particularly if you have to do it with methods which have the same signature on different classes (which are not "siblings" and therefore should both get the rename)
Is there a way to create custom collapsable code regions in Xcode similar to how Visual Studio can fold around #region/#endregion blocks?
It would be nice to throw all autogenerated content into a region that I can fold away until I need to look at it. #pragma mark doesn't seem to do the trick.
See: Xcode regions for a longer discussion, but the answer is, unfortunately, "not without an ugly hack."
I am fairly new to XCode and the Objective-C language.
When I am instantiating a class, for example an NSMutableArray, XCode will provide a whole lot of auto-complete options. Even for an empty class which simply extends an NSObject has many options, most of which seem completely useless.
What is the reason for having so many auto-complete options, or can they be "tamed" in the preferences?
EDIT: this is unintentionally a duplicate.
The auto-complete makes coding way faster. For example, in [[NSMutableString alloc] initWithCapacity:5], I only had to type the characters that are in bold face, which is ~ 10/38 = ~26%, so it saves a lot of typing.
That said, it is sometimes unwelcome. You can adjust in "Code Sense" in the Xcode preferences (type COMMAND+COMMA while Xcode is open and in the foreground). You can set the delay for suggestions and also whether it should remember functions you've previously used in that project. You can also disable it completely, if you want to. I don't think you can limit the number of functions it considers, though.