SwiftUIでEvernoteSDKを使うための準備

2022年4月15日

cocoaPodsをインストール

すでにインストールしている場合はスルーしてください。

M1なので他と多少やり方が違うっぽい。

まず、M1Macの場合は始める前にアーキテクチャを変更しておく。

code ~/.zshrc

以下を追加しておく。

alias x86='arch -x86_64 zsh'
alias arm64='arch -arm64 zsh'
alias pod="arch -x86_64 pod"
alias brew="arch -arm64 brew"
alias gem="arch -x86_64 sudo gem"

ターミナルに上記反映させる。

source ~/.zshrc

次にcocoapodsをインストールする。

sudo gem install cocoapods

Fetching cocoapods-core-1.11.3.gem
Fetching cocoapods-1.11.3.gem
Successfully installed cocoapods-core-1.11.3
Successfully installed cocoapods-1.11.3
Parsing documentation for cocoapods-core-1.11.3
Installing ri documentation for cocoapods-core-1.11.3
Parsing documentation for cocoapods-1.11.3
Installing ri documentation for cocoapods-1.11.3
Done installing documentation for cocoapods-core, cocoapods after 1 seconds
2 gems installed

セットアップコマンドをなげる。

pod setup

Setup completed

アプリのプロジェクトに対してinit

cd /Users/takumi/Documents/SwiftApp/Learning/EvernoteSample
pod init

Podfileができるので編集する。Visual Studio Codeで開く。

code Podfile

開いたてpod ‘EvernoteSDK’, ‘~> 3.0’
という部分を追加して保存。

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

target 'EvernoteSample' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for EvernoteSample
  pod 'EvernoteSDK', '~> 3.0'
end

インストールする

pod install

Analyzing dependencies
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`
Downloading dependencies
Installing EvernoteSDK (3.0.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `EvernoteSample.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] Automatically assigning platform `iOS` with version `15.4` on target `EvernoteSample` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] Your project does not explicitly specify the CocoaPods master specs repo. Since CDN is now used as the default, you may safely remove it from your repos directory via `pod repo remove master`. To suppress this warning please add `warn_for_unused_master_specs_repo => false` to your Podfile.

これでEvernoteSDKを使う準備ができました。