0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

iOSアプリの新規ブランクプロジェクト作成

Last updated at Posted at 2020-07-04

前提

  • この記事はXcode 11.5をベースに記載しています。

1. セットアップ

App StoreからXcodeをインストールしておく。
複数の開発者で開発する場合はバージョンを揃えておく。

Cocoa Podsもセットアップしておく。

参考: CocoaPodsの導入と利用 - Qiita

2. Xcodeで新規プロジェクト作成

Xcodeを起動し、Create New Xcode Project -> Single View App を指定して次へ。

Product NameOrganization Nameは任意の名前を指定。
LanguageSwiftUser InterfaceStoryboard を指定して次へ。
image.png

ファイルの保存場所を指定する際にCreate Git Repogitory on my MacにチェックをするとGitリポジトリが初期化される(チェックを忘れても後からgit init すれば OK)

プロジェクトが開いたら、一旦実行してみる。
iOS Simulatorのデバイスが選択されていないとエラーになる場合があるので注意。
image.png

3. Cocoa Pods 初期化

Xcodeを閉じて、ターミナルで空のPodfileを作成する

terminal


    cd /path/to/MyFirstApp

    pod init  

読み込みたいライブラリに応じてPodfileを編集する。ここではまだ何も導入しないでおく。

Podsディレクトリと. xcworkspaceファイルを作成する。

terminal
    pod install 

作成されたxcworkspaceファイルの方からXcodeを開く。Podsディレクトリが読み込まれた状態でワークスペースが開く。

4. Gitリポジトリを作成・共有

ターミナルでプロジェクトディレクトリへ移動。

Gitを初期化する(Xcodeプロジェクト作成時にリポジトリを作成をチェックしている場合は省略)

terminal
    cd /path/to/MyFirstApp

    git init

.gitignore ファイルを作成する

terminal
    touch .gitignore
    ls -al
    open .gitignore

.gitignoreファイルに、以下のサイトのテンプレートを貼り付ける

全てのファイルをgitコミット対象としてステージ

terminal
    git add -A
    git status #ステージされている状態を確認

プロジェクトをローカルgitにコミット

terminal
    git commit -m "initial commit"

Githubなどでリモートリポジトリを作成する

ローカルGitのリモート接続先に作成したリモートリポジトリを紐づける

terminal
    git remote add origin https://path/to/your-repository

リモートリポジトリにプッシュ

terminal
     git push -u origin master

ブランクプロジェクトの準備完了

次の記事: iOSアプリの作成(ボタンとラベルのみのシンプルコード) - Qiita

0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?