I’ve come from JS in VSCode (with loads of extensions) to Swift in Xcode.
In XCTest, I miss the red and green diffs between expected output and actual output.
In Xcode itself, I miss the ability to perform code refactoring easily (extracting code to new files etc - more than just extracting to new functions).
I also miss linting / prettier.<p>What tools and plugins for Xcode do you all use to make developing Swift in Xcode faster and easier? General Xcode hints and tips welcome.
Lots of people mentioning AppCode as a replacement, but damn JetBrains apps suck if you're used to macOS. Basic things like windows misbehaving, poor multi-monitor support (yes, really), and being unusably slow for almost every aspect of the user interface. I could go on, but if you hate Xcode I think you'll find AppCode to be just a different set of crap. If you like using a Mac you'll positively hate AppCode.<p>I personally have little problem with Xcode now. My recommendations would be: don't use the built-in source control integration, it mostly sucks. Get an M1/M2 Mac, the speed boost is great. Use a lighter weight editor (not IDE) for editing data files, large text files (>5k lines) and for anything that's not Swift/Obj-C/UI work. And lastly, stay up to date. Xcode has crashed much less for me on 12/13/14 than it did on ~9/10/11.
1) Here are some tips & tricks for refactoring: <a href="https://developer.apple.com/documentation/xcode/finding-and-refactoring-code" rel="nofollow">https://developer.apple.com/documentation/xcode/finding-and-...</a><p>The “rename in project” and “rename in scope” functions are quite neat.<p>2) Check out SwiftLint: <a href="https://github.com/realm/SwiftLint" rel="nofollow">https://github.com/realm/SwiftLint</a><p>I have not used it in a while, but it comes with good defaults and is highly customizable to your own preferred Swift style.
I don't spend very much time in Xcode.<p>I try to use the command-line tools instead.<p>xcodebuild and xcrun are solid. check out xcpretty[^1] to improve the output of xcodebuild.<p>Here's a blog post that someone wrote about using xctest from the terminal with xcpretty to make the output nice: <a href="https://mokacoding.com/blog/running-tests-from-the-terminal/" rel="nofollow">https://mokacoding.com/blog/running-tests-from-the-terminal/</a><p>[^1]: <a href="https://github.com/xcpretty/xcpretty" rel="nofollow">https://github.com/xcpretty/xcpretty</a>
Check out AppCode by JetBrains. It reduces the need to use Xcode by 90%.<p><a href="https://www.jetbrains.com/objc/" rel="nofollow">https://www.jetbrains.com/objc/</a>
1. Have a dedicated Apple machine for Xcode. Don't put anything else on it.<p>2. Reformat (clean install) machine every 1-2 months.<p>3. Upgrade machine every 1-2 years.<p>* Regularly export and back up your Xcode developer profiles and certificates.<p>* If you're thinking about doing something fancy, don't. It will come back to haunt you in ways you cannot even imagine.<p>Source: 10+ years of iOS development.
Swiftlint[1] is nice and can be integrated into Xcode’s warning panel.
For auto-formatting, you can press CTRL-i on any selection to auto-format.<p>[1] <a href="https://github.com/realm/SwiftLint" rel="nofollow">https://github.com/realm/SwiftLint</a>
I developed in ObjC till 2016, so my opinion are dated but:<p>- Xcode is an acquired taste. A bit slow and crash prone, but most of my issues came from the frameworks. Completion and linting were good enough and the integration with dtrace was enough to help me move faster than my colleagues. I even did use Xib :D<p>- I tried multiple time app code: it’s not good either. In fact, I don’t like most of the jet rains product, but they’re easier to set up than the competition so….<p>- but now I’m back to nvim or emacs.<p>I don’t develop as my job anymore, so my tooling seems pretty barebone to what seems to be the trend :) I nearly make do with the Processing/Arduino IDE and they’re both horrible.
I think your main pain point stems from the difference in ecosystems. This is not even a good/bad thing, just a "things are done a bit different" thing.<p>If you take a look at the functionality that you are after, perhaps moving out outside of the scope of the editor may help you far more than trying to re-compose the editor to be more like something that it isn't.<p>I personally don't have much of an issue switching between them, I mostly prefer Sublime Text over everything but it doesn't have the features I need for everything so I just use whatever tools the project needs the most. For iOS and macOS the whole workflow split in two parts: a common CI part where all the external tools run, and the in-editor part where you mostly just write the features you want. This applies to AppCode too, but we also do that for C# code where it really doesn't matter if you do it in Rider or Visual Studio on Mac, Visual Studio on Windows or Visual Studio Code anywhere. In the end, the pre-commit and CI tasks will do the common workflow anyway.<p>While I understand that people enjoy digging deep into the features of a single specific IDE to do everything, in reality this is probably not the 'best of all worlds', unless you are working solo.
One thing I‘ve really come to appreciate (applies to all code editors) is to actively use keyboard shortcuts for moving selected lines up/down, and for deleting the current line. Vim users will be used to this anyway, but for the rest of us it’s a great way to code faster.<p>The other thing (since Xcode‘s clipboard feature is IMO clunky) is to use a clipboard manager with the history set to a decent size. I use Paste (happens to come with SetApp) and never once lost a copied snippet - it‘s rock solid. I’ve developed a habit of just copying whole files in case I want to revert to that state (or partially) later.
Xcode definitely has it's issues but I think they're moving to a system where Swift, and the Swift Package Manger specifically, can provide a bunch of this kind of functionality.<p>Take a look at this 'Meet Swift Package Plugins' talk from WWDC 22 which goes into detail: <a href="https://developer.apple.com/videos/play/wwdc2022/110359/" rel="nofollow">https://developer.apple.com/videos/play/wwdc2022/110359/</a><p>What's nice about this is that it's not restricted to Xcode, it can be integrated with your CIDI, too.
I have one single tip.
Don't use storyboards / nibs.
Write all you view code by hand. Stackviews and your own layer of helper functions are you friend. I can write UI faster in code than would ever be possible in nib tooling.
To say nothing of managing conflicts in those files. You won't look back!
for me, main thing is turning on the (now native) vim emulation which is decent though missing some things (dot operator please!), and learning the keyboard shortcuts for the various UI panes<p>for "prettier" all I've ever needed is just auto indentation of a block, which works fine<p>other than that, I just submit to what Xcode is and live with it