Difference between revisions of "Mobile App Dev 2021W: Getting started with Xcode"

From Soma-notes
Jump to navigation Jump to search
Line 23: Line 23:
[[File:Xcode-App-template.jpg|800px|Xcode app template]]
[[File:Xcode-App-template.jpg|800px|Xcode app template]]


==Project options==
==Project options 1==


You should next see a project options screen that looks like the following if you've never run Xcode before:
You should next see a project options screen that looks like the following if you've never run Xcode before:
Line 54: Line 54:
[[File:Xcode-cert-create-1.jpg|800px|Xcode creating signing certificate 1]]
[[File:Xcode-cert-create-1.jpg|800px|Xcode creating signing certificate 1]]


==Project Options 2==


After having logged in with an Apple ID and creating a certificate, you should now be able to select your personal team in the project options dialog:


[[File:Xcode-create-project-1.jpg|800px|Xcode create project 1]]
[[File:Xcode-create-project-1.jpg|800px|Xcode create project 1]]
==Saving the project==
After finishing with the project options you'll be asked where to save the project.  Note that by default Xcode will set up git for version control.  This will cause problems as we will see.


[[File:Xcode-create-project-2.jpg|800px|Xcode create project 2]]
[[File:Xcode-create-project-2.jpg|800px|Xcode create project 2]]





Revision as of 01:08, 17 January 2021

Below are instructions on how to get a first SwiftUI app running in Xcode and ready to install on one of your iOS devices.

To follow this, you'll need a machine running MacOS Catalina or Big Sur and an Apple ID. You do not need a developer account; however, make sure that your device uses the same Apple ID as the one you configure below.

Installing Xcode

First, you need to download Xcode from the Mac App Store. Once you find it, installing it should be as simple as clicking on the install button. Once installed, you should see a screen that looks something like this:

Xcode install from the Mac App Store

Creating a project

Once you have Xcode installed, run it. When it starts, you should see a splash screen, as shown below. Click on create project as shown.

Xcode splash screen

If you don't see this screen, don't worry, just select File->New->Project through the top of screen menus.

Project template

You'll now be asked to select a template. Select the multiplatform app template, as shown here:

Xcode app template

Project options 1

You should next see a project options screen that looks like the following if you've never run Xcode before:

Xcode project options

Note that, beside Team, it says to add an account. You need to add an account in order to be able to run apps on a device. Go ahead and click on Add Account.

Adding an Apple account

After clicking Add Account, it should take you to Account Preferences and should give you an option to add many kinds of accounts. Add an Apple account:

Xcode adding account


Adding Certificates

You'll need to create a certificate to go with your Apple ID in order install applications on a device. Create the certificates as follows:

Entering the Certificate Manager

Once you've added an Apple account, you should see it listed. On this same screen note the Manage Certificates in the bottom right corner. Click on this button:

Account Added

Create a certificate

To create a certificate, click the plus in the bottom left corner. This button produces a menu which should just have one option, one for creating an Apple Developer certificate. Select it to create a certificate. After you do so, the dialog should list a certificate as follows:

Xcode creating signing certificate 1

Project Options 2

After having logged in with an Apple ID and creating a certificate, you should now be able to select your personal team in the project options dialog:

Xcode create project 1

Saving the project

After finishing with the project options you'll be asked where to save the project. Note that by default Xcode will set up git for version control. This will cause problems as we will see.

Xcode create project 2


Xcode setup, version control 1

Xcode setup, version control 2


Xcode choosing platform