开发者

Xcode 4 Tips and Tricks for Xcode 3 users [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 10 years ago.

As most of you have probably开发者_如何学Go seen, Xcode 4 has been released officially today. Now I know that plenty of devs out there have been using the preview versions, and it'd be great if people could post any great tips, tricks, or keyboard shortcuts they've learned using those version now they're no longer under NDA. This could be especially useful for those upgrading from Xcode 3 (like me, downloading right now).

Note: Apple have released a 'transition guide' that has plenty of stuff in about getting from version 3 to version 4, but I bet there are loads of great tricks people out there have learned that aren't in there.


I liked reading this Blog: Pilky.me - Xcode 4: the super mega awesome review.

It presents a good comparison, I especially liked his conclusion near the end.


Currently I have only one tip for Xcode 3 users - don't use xcode 4 unless you have free time to start learning again and/or are willing to report lots of bugs. Wait at least until 4.1. There are still lots of bugs unresolved. Nothing is stable. Also Xcode 4 advertises as having single window ui which is nice, but is unstable as U238. Also - it's probably single thing that is good about new Xcode 4. So here are some of my headaches currently:

  • There is no possibility to commit whole project (except for separately selected modified files);
  • There is no possibility to push (if SMC is git). At least I haven't found that;
  • Since symbol indexing is broken you cannot:
    • see normal syntax highlight;
    • jump to certain symbol definitions;

Jump bar is just one big misunderstanding:

  • Previously comfortable Ctrl+2 shortcut from Xcode 3 which lists method names and pragma marks has now become finger breaking Ctrl+6 (emacs user's rejoice</flamewar>).
  • There is no direct button to switch between interface and implementation files.

If you have 13.3" macbook[pro] - don't even try to use navigators with utilities (inspectors or libraries).

Also transition guide is made for working Xcode 4 which it is far from.

Update 1:

There is no such thing as "Build & Run". Only build, build for running, build for testing, build for profiling, build for archiving. Then just run without building and run without profiling. AFAIK it supposed to be easier so summa summarum - 8 actions instead of 1. Go figure.

So these are only few of my instantly found glitches for Xcode 4.

P.S. probably will be updating this in upcoming few days.


@Ohmu: The 3-finger up/down trackpad/magic mouse swipe gesture for switching between header (.h) and implementation (.m) files still works a treat.


XCode 4 has a lot of awesome new features. I'd recommend starting to adjust to it by watching last year's WWDC2010 videos - they dedicated a lot of time to going through some of the new stuff.

  • I love the new assistant mode - it makes it really easy to navigate through your interface/implementation files. This mode also allows you to create your user interfaces alongside your controller classes, which makes development both easier and more effective than doing it in two completely separate programs!

  • The jump bar (found along the top of your source code) is a really fast way to leap about your project, making it really easy to get exactly to the place in your code that you're interested in.

  • The version control viewer makes it really easy to track changes. I now use SVN for all my projects, even the ones I work on alone because it really makes it clear to see how the project has evolved over time.

  • There are settings to set how your layout changes and what's displayed when you build, when you run, when you end a run etc. etc. which I'm also finding really useful because you want to see different things when you'e debugging to when you're back in your code. It's really nice that Xcode helps you easily arrange your layout to exactly how you want for different scenarios.

  • The code templates (which can be found in the toggleable right-hand-side toolbar) are also really useful, and you can create your own in order to quickly get code you often write down.

Some more subtle things that I've grown to like:

  • The 'Fix It' feature works really well for quickly replacing typos. I find I don't even have to read the correction Fix It will make because the fix is so natural.

  • Control-I short cut for re-indenting code. This is really useful if you add a new pair of braces round your code and you want to quickly reformat. I don't think there was a nice shortcut for this in Xcode 3.

  • Hitting the escape key to bring up autocomplete suggestions seems to bring up much more helpful suggestions in C++, and looks a lot more beautiful all round!

On reliability, I've been using a combination of Xcode 4 and Xcode 3 since Xcode 4 first entered beta. Whenever Xcode 4 packed in for me or wouldn't let me continue with what I wanted to do then I'd just switch over to Xcode 3 as the two are completely compatible. What I got was a really nice transition period and now I'm completly using the latest build (first week of March) so I think it's very stable.

For people that don't like change, this update is going to be hard. It'll be particularly challenging as a lot of the keyboard shortcuts have changed to make new for a lot of new features. The most obvious difference that people are going to oppose is the new all-in-one window layout. I'm sure people will get used to it over time and realize that this way of viewing everything to do with your project is much more effective both in real estate and in navigation terms.

Enjoy using Xcode 4, it really is an amazing improvement over the last version, and it continues to add to the awesome time I'm having writing Mac and iOS applications. :D


More shortcuts than you can shake a stick at here: http://cocoasamurai.blogspot.com/2011/03/xcode-4-keyboard-shortcuts-now.html

However, completeness is obscuring clarity. For example, I can't straightaway see the shortcut for toggling between a header file and its associated method file. so I recommend one shortcut per answer, and the votes will filter out the best ones.


If you need to open plist files when you are not coding you should keep a copy of XCode3/Applications/Utilities/Property List Editor.

Property List Editor opens within the blink of an eye. But XCode4 takes minutes until it finally shows the plist file.

I guess Apple wants me to replace my 2008 MBPro


NB: Apple's official transition guide has moved/been updated (they didn't update the URL, sigh). It's now at:

http://developer.apple.com/library/mac/documentation/IDEs/Conceptual/Xcode4TransitionGuide/Xcode4TransitionGuide.pdf


The only way for me to like XCode4 is thinking it as a different product. There's NO evolution over XCode3, just lots of drawbacks for the way I use it.

  1. Who changes (almost all) shortcuts between version of the same software?
  2. Why do I have to learn back from zero how to use and configure my projects? Sounds like punishment, not evolution.
  3. How good is XCode4 for multiple monitors usage? It was clearly designed for a single monitor user, but unlike Xcode3, its UI cannot be as easily (and persistently) changed.
  4. Although it can be disabled (and must), auto code check for errors... So we're back on VB6 now?

I'm a BIG Apple fan, though XCode4 falls short on developer satisfaction due to its lack of customization (compared to XCode3).

Not using XCode3 as a comparison, it is indeed a good IDE.

A frustrated developer, Cheers.


Risky business: Moving to Xcode 4 will introduce you to a whole new level of strange behaviour, bugs, and pain. E.g. having third-party frameworks (like Three20) in your app, means that you won't be able to build a proper archive, without jumping through various levels of hoops. Don't move to Xcode 4 yet, if you can. If you do, there are some tips below.

Keep your archives safe: ...prior to installing Xcode 4 (from 3). You will lose them (most likely) and with them lose your ability to symbolicate your crash logs.

Adding frameworks: It took me a while to figure this out, and it's nowhere in the docs. You cannot simply do this by right-clicking on the project or a group (like in Xcode 3). You need to go to the project view, select your target and go to "Build Phases" tab. Frameworks can be managed under the "Link Binary with Libraries" section.

Setting target dependencies: Similar to the above, in the "Target Dependencies" section of the "Build Phases" tab.

Delete action-BEWARE: "Delete" (instead of "Remove Reference Only") directly erases the file from your drive. It doesn't go into the Trash, so you cannot recover it.

Text Editor: Here a couple of good ones:

  • Cmd-clicking on a class name will take you to the implementation (or header) file of that class, cmd-clicking on an object will take you to where the object is declared.
  • Alt-clicking will open a documenation popup for the object you clicked on.


3-finger sideways gesture to left is the Back button, and goes to your previous file. Gesture to right goes to your next file in the stack. (not sure if this was true in XCode3)


http://pragmaticstudio.com/screencast-tags/xcode4

After watching these great little videos, I instantly warmed to XCode4

They have really sorted it out big-time in so many different places, making conceptual changes such as:

  1. one window = NICE
  2. TextWrap
  3. removed annoying 'stop running + rerun' dialog
  4. good color scheme facility
  5. CMD SHIFT O to locate a header file
  6. The auto completion is sorted out beautifully
  7. clear console button
  8. search & replace NICE
  9. new keybindings NICE
  10. On-the-fly error checking - love it!

As you can see, I made notes over the first 2 days of using it; every time I liked something, or every time something went wrong I would jot it down.

So far I have listed 16 problems, but these are all glitches, such as the colouring system going wrong in certain situations etc... ie all minor things that will get patched up pretty soon in updates.

With the occasional crash, I am not going back to 3.x unless I absolutely have to.

The only thing which really gets my goat is that Apple STILL refuse to support incremental updates. it is totally crazy, and I hope everyone makes a lot of noise about it until they sort it out.


I wondered where per-file compiler flags had gotten to.

Spoiler: Select project, select target, select Build Phases tab, expand Compile Sources phase and rejoice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜