Install Xcode and use Hello Swift!


I summarized how to run the iPhone application on the actual device with Xcode. I will also try source control from Xcode on GitHub.

Xcode installation

Search for xcode in the App Store and install the app that appears.

I had an older version of Xcode installed so I tried to update it I got an error saying The product cannot be installed because there is not enough free space even though there is enough free space.

Perhaps the time machine was affecting the capacity of the app install. Once I uninstalled Xcode and emptied the Trash, I was able to install it successfully.

There seems to be a way to install Xcode directly. [Solving the problem that "There is no free space available" when installing Xcode from the App Store]( -to-install-the-product /)

Create an app with Xcode

Now that the installation is complete, let's create an app. Since the purpose is to run it on the actual machine, I will make an application that displays only Hello Swift.

Project creation

Start Xcode and create an app from Create a new Xcode project.

Then select App and Next スクリーンショット 2020-10-28 23.29.34.png

Project Name: The name of the app Team: Not set (set later) Organization Identifier: Unique ID like email address Interface:Story board Life cycle:UIkit App Delegate Language:Swift スクリーンショット 2020-10-28 23.30.00.png

I want to create a Git repository locally, so check Source Control. If you don't need Git management, remove it. スクリーンショット 2020-10-28 23.30.20.png

hello swift Open Main.storyboard, open the + button (Library) on the upper right, and place Label on the screen by dragging and dropping. Change the Text in the Show the attribute inspecter menu on the right side of the screen to Hello Swift.

Run with simulator

You can run the simulator by selecting the device type from the frame (active scheme) next to the ▶ ︎ button and pressing the ▶ ︎ button.

If Hello Swift is displayed, it is successful.

Run on the actual machine

This time I used my iPhone 8 Plus. First, connect your Mac and iPhone.

Apple ID registration

Register the account by pressing the + button on the setting screen of [Xcode] → [Preference] → [Accounts].

Enter your email address and password to complete the registration.

Set Team

Select the folder where the app name is displayed in [Project Navigater] on the left side. In the [Signing & Capabilities] menu, set the Team of the Apple account you registered earlier.

Could not launch "xxxxx" After selecting the device in the active scheme, press the ▶ ︎ button to execute it, but I got an error like this. xxxxx is the app name.

From the iPhone screen, open [Settings] → [General] → [Device Management]. Since the email address registered with your Apple account is displayed, set this account to be trusted.

Click the ▶ ︎ button again to complete the startup.

Managed on GitHub

Let's manage the project created this time on GitHub.

Works with Github

Just like an Apple account, register your Github account by pressing the + button from [Xcode] → [Preference] → [Accounts].

Creating a remote repository

Since we already have a repository locally, we will create a remote repository. Select Show the Source Control navigator on the left side of the screen, right-click Remotes and selectNew xxxxx Remote create a remote repository.


Select the file to commit and push from [Source Control] → [Commit ...]. After that, write a comment in the commit message, check Push to remote and commit, and it will be reflected in the Github repository.

Recommended Posts

Install Xcode and use Hello Swift!
Use swift Filter and Map
[Swift] Create a project with Xcode (ver 12.1) and display "Hello, World!"
[Swift] Display Hello Swift!
Use XVim2 with Xcode 12.0.1
Install and configure Keycloak
[Swift] Constants and variables
[Swift] Let's use extension
[Swift] Use for where rather than nesting for and if
Install buildah and container-selinux
[PHP8] Install and use PECL YAML function (YAML parser) with Docker
[Swift] How to install Firebase ~ How to use Realtime Database & Cloud Firestore
[Swift] Let's use Segmented Control
Use Swift Package on Playground
[Swift] How to use UserDefaults
How to use Swift UIScrollView
Let's use Swift Firebase Firebase Auth
Difference between bundle and bundle install
[Swift UI] Use Map view
How to install and use Composer on an ECS instance on Ubuntu 16.04
[Tips] How to solve problems with XCode and Swift for beginners
Steps to install Maven on Mac and use it in Eclipse