LoginSignup
1
1

More than 5 years have passed since last update.

pod installしたライブラリのswiftバージョンが古くてBuildできないときの対処法

Last updated at Posted at 2018-11-17

概要

pod installしたライブラリのswiftバージョンが古くてBuildできないときの対処法について
実際に僕が陥った状況と、どのように対処したかをまとめます

環境

Xcode Version 10.1
cocoapods version 1.5.3

やりたかったこと

Swift 4.2の開発環境に、Tinder風UIライブラリZLSwipeableViewSwiftを導入(pod install)したかった

やったこと

Podfileを以下のように作成し、pod installした

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

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

  # Pods for AppName
  pod 'ZLSwipeableViewSwift'

end

起きたこと

swift3.0記法が原因に思えるエラー大量出現
image.png

直すためにやったこと

対象のライブラリのcommitログを拝見し、swift4対応まで行われていることを確認。
image.png

ではなぜpod 'ZLSwipeableViewSwift'では、swift3系でinstallされたのか。
→無理やり最新のコミットを指定すれば、swift4系の改修が取り込まれているはず。

そこで、pod installしたいライブラリの最新のcommitを指定し、pod updateを実行

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

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

  # Pods for AppName
  pod 'ZLSwipeableViewSwift', :git => 'https://github.com/zhxnlai/ZLSwipeableViewSwift.git', :commit => '18d6109'

end

無事、ビルド成功しました。

参考文献

あとがき

一旦、 ちからわざ即席で対応しましたが、もっとスマートな解決方法がありましたら、どなたかご教授ください

1
1
1

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
1
1