Xcode

Getting started with Xcode

Remarks#

Xcode logo

Xcode is an integrated development environment for macOS which supports the development of native apps for macOS, iOS, watchOS, and tvOS. Xcode is the successor to NeXT’s Project Builder and PBX. (In fact, Xcode’s project manifest files are still named with the .pbxproj extension.)

Xcode releases include stable versions of the clang C/C++/Obj-C compiler, the Swift compiler, the LLDB debugger, and iOS/watchOS/tvOS simulators. Xcode also includes Interface Builder, as well as tools for viewing and editing 3D models and scenes, image assets, and more.

Versions#

VersionRelease Date
1.02003-09-28
2.02005-04-04
3.02007-10-26
4.02011-03-14
5.02013-09-18
6.02014-09-17
7.02015-09-16
7.1.12015-11-09
7.22015-12-08
7.2.12016-02-03
7.32016-03-21
7.3.12016-05-03
8.02016-09-13
8.12016-10-27
8.22016-12-12
8.2.12016-12-19
8.32017-03-27
8.3.12017-04-06
8.3.22017-04-18
8.3.32017-06-05

Get Started

  • Download Xcode from the Mac App Store.

  • Click to create a new project or playground:

Xcode welcome window

Use multiple versions of Xcode

You can have multiple versions of Xcode installed at the same time (including beta versions). Simply rename the application in Finder to avoid conflicts.

renaming Xcode in Finder

Note: Installing Xcode from the App Store will tend to overwrite an existing version on your machine. You can also install Xcode from a direct download to get more control over which versions you have.

Each copy of Xcode includes command line tools (clang, xcodebuild, etc.). You can choose which ones are invoked by the commands in /usr/bin.

In Xcode’s preferences, under the Locations tab, choose a version of Xcode:

Locations preferences

Or you can manage versions from the command line using xcode-select:

# Print the currently selected version
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

$ clang --version
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

# Find all installed versions using Spotlight
$ mdfind 'kMDItemCFBundleIdentifier = "com.apple.dt.Xcode"'
/Applications/Xcode.app
/Applications/Xcode72.app

# Check their version numbers
$ mdfind 'kMDItemCFBundleIdentifier = "com.apple.dt.Xcode"' | xargs mdls -name kMDItemVersion
kMDItemVersion = "7.3"
kMDItemVersion = "7.2.1"

# Switch to a different version
$ sudo xcode-select --switch /Applications/Xcode72.app

$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.4.0
Thread model: posix

Changing The Color Scheme

Many developers like to customize the font, text, and background color of their IDE’s. You can do this in Xcode by opening the app preference pane, either by going to XCODE->Preferences, or by pressing ’⌘,’

Getting to Preferences

With the preference pane open you can click on the ‘Fonts and Colors’ tab.

Editing colors and fonts

From here you can change the source AND console background and font colors. There are many pre-made color and font schemes provided with Xcode. You choose these from the list on the left (Basic, Chalkboard, etc). You can find and download more online (like here for example).

To further customize any theme, you can customize any of the types listed in the right pane (Plain Text, Comments, Documentation Markup, etc). For example, say I really want my ‘Numbers’ to show up in my code. So I change the font to ‘American Typewriter’ at 24 px, the color to a greenish color, and set the line highlighting to red:

Bold Numbers, Yay!

Now in my text editing, I can really see my numbers:

Cool colors in action!

Now you can customize the look and feel of the ‘Source Editor’ and ‘Console’ to your hearts delight!

Pro Tip

Many developers like to theme their IDS dark (light text, dark background). In Xcode, you can only do this for the ‘Source Editor’ and the ‘Console’. However, the Navigation (left side), Debug (bottom), and Utility (far right) sections are non-customizable. There are two work arounds to this. First (kind of tricky, is to leave the IDE light themed (Light background, dark text) then invert the screen colors all together. This will make everything dark, but colors in the simulator and in the rest of the system are now wonky. The second work around is to hide The Navigation, Debug, and Utility areas when not in use. You can toggle these areas quickly using the following commands:

Navigator : ⌘0

Debug Area : ⇧⌘Y

Utility : ⌥⌘0


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow