Downloading and installing Xcode from the App Store
Xcode is Apple’s integrated development environment (IDE) for developing iOS apps. Before you begin writing your first iOS app, you need to download and install Xcode from the App Store on your Mac. To do this, follow these steps:
- Choose App Store from the Apple menu.
- In the search field in the top-right corner, type
Xcode
and press the Return key. - You should see Xcode in the search results. Click Get and then Install.
- If you have an Apple ID, type it in the Apple ID text box. If you don’t have one, click the Create Apple ID button and follow the step-by-step instructions to create one:
Figure 1.1: Apple ID creation dialog box
You can see more information on how to create an Apple ID using this link: https://support.apple.com/en-us/HT204316#appstore.
- Once Xcode has been installed, launch it. You should see a License Agreement screen. Click Agree:
Figure 1.2: License agreement screen
- You will be prompted to enter your Mac’s administrator
username
andpassword
. Once you have done so, click OK:
Figure 1.3: Prompt for administrator username and password
- You will see a screen showing you the available development platforms. You just need Mac and iOS for now. Leave the settings at their default values and click Install:
Figure 1.4: Development platforms screen
- If you are using an Apple Silicon Mac and have not yet installed Rosetta, which allows Intel-based Mac apps to run on Apple Silicon Macs, you will be prompted to install it now. Click Install:
Figure 1.5: Rosetta prompt
- You should see the following Welcome to Xcode screen. Click Create a new Xcode project in the left-hand pane:
Figure 1.6: Welcome to Xcode screen
- You will see the new project screen as follows. In the Choose a template for your new project: section, select iOS. Then choose App and click Next:
Figure 1.7: Choose a template for your new project: screen
- You will see the Choose options for your new project: screen:
Figure 1.8: Choose options for your new project: screen
Configure the options shown in the preceding screenshot as follows:
- Product Name: The name of your app. Enter
ExploringXcode
in the text field. - Organization Identifier: Used to create a unique identifier for your app on the App Store. Enter
com.yourname
for now. This is known as reverse domain name notation format and is commonly used by iOS developers. - Interface: The method used to create the user interface for your app. Set this to Storyboard.
- Language: The programming language to be used. Set this to Swift.
Leave the other settings as their default values and make sure all the checkboxes are unticked. Click Next when done.
- Product Name: The name of your app. Enter
- You’ll see a Save dialog box. Choose a location to save your project, such as the Desktop or Documents folder, and click Create:
Figure 1.9: Save dialog box
- You will see a dialog box saying Git Repository Creation Failed, click Fix.
The reason why you see this dialog box is because the Source Control checkbox is ticked. Apple recommends that Source Control be turned on. Source Control is outside the scope of this book but if you wish to learn more about version control and Git, see this link: https://git-scm.com/video/what-is-version-control.
- You will see the Source Control setting screen as follows:
Figure 1.10: Source Control preference screen
Enter the following information:
- Author Name: Your own name
- Author Email: Your email address
Close the Source Control setting screen by clicking the red Close button in the top left corner when done. The Xcode main window will appear.
Fantastic! You have now successfully downloaded and installed Xcode and created your first project. In the next section, you will learn about the Xcode user interface.