Alamofireを手動で入れる(メモ)
AlamofireのManuallyに書いてある通り、git gubmoduleを使ってAlamofireを使用するやり方。
プロジェクト作成
Alamofireを使用するプロジェクトを作成する。このときSource ControlのCreate Git repositoryにチェックを入れておく。
Git submodule
作成したプロジェクト配下でgit submoduleを実行する。
git submodule add https://github.com/Alamofire/Alamofire.git
Alamofireをプロジェクトに追加
- Alamofire.xcodeprojをプロジェクトナビゲーターにドラッグ&ドロップ
- プロジェクトナビゲーターのAlamofire.xcodeprojを選択
プロジェクトのTarget -> General -> Embedded Binaries の + ボタンを選択
- Alamofire.xcodeprojの中のProductsのAlamofire.frameworkを選択。このとき、Alamofire.xcodeprojは2つ表示されるが、どちら を選択しても良い。また、表示されているAlamofire.frameworkは上がiOS用、下がOX X用。
完成。
自動的にTarget Dependencies、linked framework、embedded frameworkにAlamofire.framework が追加されている。
ノート
ビルド前にAlamofireを使用すると、import AlamofireなどでNo such module 'Alamofire'と 表示される。一旦cmd+BでAlamofire.frameworkをビルドすればOK?