iOSアプリ開発 FontAwesomeKitをプロジェクトにインストール

■前提 gemでpodはインストールされていること。

gemからインストー
  sudo gem install cocoapods
 pod setup

■プロジェクトにインストー

●1.PodFileを作成

ターミナルで以下のコマンドを実行

cd プロジェクトのパス
pod init

→PodFileが作成される。



●2.PodFileに以下を追記

pod 'FontAwesomeKit', '~> 2.1.0'

↓以下のように

                                                                                                                                                  • -

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'SimplePhotoSlideShow-mobile' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!

# Pods for SimplePhotoSlideShow-mobile
pod 'FontAwesomeKit', '~> 2.1.0'
end

                                                                                                                                                  • -


3. pod installを実行
ターミナルで以下のコマンドを実行

 pod install

Podsプロジェクトが作成される。
 
Xcodeワークスペースを開き、Podsプロジェクトが左ツリーに追加されていればOK

4.プロジェクトのビルドで、フォントファイルをリソースを追加するように設定。

 Project→build PhasesのCopy BundleでFontAwesome.otfを追加

 ※これをやっておかないと、起動後に
  Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Font file doesn't exist'
 が発生。