I want to ask you if there is any code arrangement functionality in XCode 7+?
I ran into a situation where I want to make my code more readable and organized. For this I have to (re-)sort some functions and elements (Swift) inside some source code files.
Being also an Eclipse and IntelliJ user I am used to have a couple of options, like rules-based auto-sorting or an outline view where I can move functions etc. around. Haven't seen something like this in XCode so far - sure, there is an "outline view" (aka. Symbol Navigator), but it is really only a viewer. -.-
I also know about the CMD+Opt+[ / ] shortcuts but this kind of manual sorting is tedious.
Is there a better way? Thank you.
Martin
As of Xcode 7.3, there is no better way of doing what you want. As an IntelliJ user, you may want to try AppCode by JetBrains.
Related
I'm a total beginner in Swift, so I always find the quick help in Swift 2.2, Xcode 7 very useful(You hold down option key and click on something and the Xcode would give you a pop-up window containing all sorts of information about the variable you are clicking on). However, after I updated to Swift 3.0 the pop-up window becomes blank and a message "No Quick help". I'm wondering if someone could tell me how to bring the quick help back, thank you!
This is an Xcode question. Quick Help only works with Swift when you don't have any errors before or in the current line you want to open the Quick Help from.
I also experienced this and it seems this feature worked much better with older Xcode versions. But I guess this has to do with Swift because it is such a fast growing programming language. The integrated interpreter of Xcode isn't able to keep up with it.
To work around it, just comment out all failing lines of code and then comment in one line by one while fixing the errors. Sometimes it is helpful to also clean up the generated project files. And if this also doesn't work, just restart Xcode.
The last step is often necessary when you're in a Playground.
Please do you know about any tool which would allow me to debug Android UI in the way web debug tools work? I mean view which style is applied to each particular View, or also I would like to be able to see some inheritance tree etc..Do you guys know about something like that?
The only way I know of to look which style is applied is to look in xml. Simply search for Style and you'll be able to go through them one at a time, but something like web debug doesn't exist as far as I know.
Inheritance trees for styles are also not present and you'll have to go through them the hard way (writting on paper or something). In general android styles is a pain to learn but when you've learned to navigate it you'll be able to live with it :)
I haven't found a method to do so other than Warpzit's method. In Eclipse, there is a helpful tool to see your UI hierarchy though. When in debug mode, open the "Devices" window (if you can't find it: Alt+Shift+Q, Q). Then click the "Dump View Hierarchy for UI Automator".
You can see some view attributes there as well as the way it's build up.
There's also a hierarchy viewer in the SDK tools/ directory, but I haven't used it yet.
I know this is not the answer you're looking for, but this is what I do because I don't know of a better way.
On Eclipse, I start with the xml layout in question and I drill down by pressing the Ctrl key (or the Command key on a Mac) and clicking on the style in question (the style name becomes an hyperlink when that key is pressed down and I hover the mouse over it). Then, I use the yellow arrow keys on the Eclipse toolbar to come back through each pane of code once I need to go back to the root of where I started from.
On Android Studio Preview, which unfortunately I can't use at work because everyone uses Eclipse, the same shortcuts work as well, but unlike Eclipse, the navigation support and the refactoring support work much better, I'd recommend that you look at Android Studio if you're not satisfied with Eclipse's support (my only warning is that once you have a version of Android Studio that works for you, that you do not update it, because updates of Android Studio tend to break it frequently).
To find it, please go to Layout Inspector,
Tools --> Android --> Layout Inspector
Something that I have always wanted in TextMate was a different way to open files.
For instance, when I open a file in TextMate, I would love the active tab to default in position 1. Then when I open another tab, that tab should take over position 1, and the rest will shuffle down the list.
Are there any plugins for TextMate that provide this type of functionality?
I don't believe such a plugin exists.
There are two plugins providing supercharged alternatives to the project drawer:
MissingDrawer
ProjectPlus
They don't provide the feature you want but you could try to get in touch with their authors to see if they can add it or point you in the right direction.
The ProjectPlus project has been pretty much dead for years (there are unanswered pull requests from january/february 2011) but there seems to be some action on MissingDrawer.
If you know Objective C you may be able to hack something from their sources.
Whatever the outcome it may work for the "click on a file in the drawer" way of opening a file but not for other ways.
Did you look at TextMate's .plist? I've heard there are some hidden gems there.
Xcode 3.2 has implemented cursor-level history for the "Go Forward", "Go Backward" commands. Previously these worked at the file level, so you could navigate back and forth through recent files you've been editing. Now they navigate at a more fine-grained level, through the places within files where you have been editing.
The downside to this is if you navigate backwards through the files and make a minor edit, all of your forward history is wiped out, whereas in the past it used to be easy to return to the file you were working on. It also means issuing a lot more commands if you just want to move through files, since you have to skip through all the edit points within each file.
I can't find anything in the release notes or documentation about this new behavior, so does anyone know if it's possible to get the old 'go back/forward by file' commands in 3.2? If not, does anyone have any tips on other ways of easily navigating recent files in Xcode?
Hold down the option key while you click the forward/backward arrows at the top of the code view, this will use the Xcode 3.0 behavior and go back a file at a time.
I had the same question as well and and Rob's answer on holding Option while clicking the forward/backward arrows works well.
I needed a keyboard shortcut though and I've found that Shift-Option-Cmd-left/right works.
From the comments on this blog entry:
Hold down the Option key to get the old file-based Go Forward/Go Back behavior. We rarely change established behavior like this when adding new options, but in this case, the majority of users considered file-level navigation Broken and location-based navigation Correct, based on their experience in browsers and other IDEs. We chose to give what more people considered the “obvious” behavior the pride of place on the keyboard shortcut, but the old way is still there.
-- Chris Espinosa
But like you guys have said, after every keyboard edit, the forward file history is lost. This is incredibly frustrating to me, as this is a feature I have heavily relied on for years, which is now broken. Is there still no fix?
There are Next File and Previous File commands, however their history is also wiped out after an edit. That seems like a bug to me.
This is plain stupid! What's the reason for suddenly change this ? Shift-Option-Cmd-left/right... great, more stupid shortcuts from Apple. I guess I soon have to use Shift-Option-Cmd-Left-Alt-Enter-N for something I use all the time. Can't they just implement a recent file list on ctrl-tab or something, like the Cmd-tab and the app switcher. Why would I want to grab for the mouse when I'm coding ? Still I have to use it lots in Xcode.
Sorry for my rant :)
I have fallen in love with visual studio's code snippets toolkit. Is there anything similar on Xcode?
You can also take a loot at this question which is about similar issues with XCode 3 (code templates, code completion, and more).
Xcode 4 has support for code snippets.
Of course there are. They are under "Edit -> Insert Text Macro".
Or you can simply start typing 'if<ctrl+.>' and this will be expanded into the full if statemenet.