13
7

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 5 years have passed since last update.

【SwiftLint】CocoaPodsでSwiftLintを導入する

Posted at

CocoaPodsでSwiftLintを導入する参考ページが少なかったので備忘録。

環境

Xcode 9.0
Swift 4.0

SwiftLintをインストール

Profileに以下のように記載して、「pod install」

(Profiileの例)

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

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

  # Pods for rules-demo
  pod 'SwiftLint'

  target 'rules-demoTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

インストール後の設定

スクリーンショット 2018-01-22 23.47.47.png

上図の赤枠に以下のテキストをコピペする。
※Homebrewでインストールした場合とテキストが異なるので注意!

if which "${PODS_ROOT}/SwiftLint/swiftlint" >/dev/null; then
${PODS_ROOT}/SwiftLint/swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

動作確認

⌘+Bで、Bulidをしてください。
SwiftLintの動作確認が出来ましたら、これで導入は終わりです!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?