0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Xcode 16 / Swift 6.0】SPMを用いたSwiftLintの導入方法について

Last updated at Posted at 2025-02-16

環境内容

Xcode: 16.2
Swift: 6.0.3

手順

  1. "Add Package Dependencies"を押下
    スクリーンショット 2025-02-16 21.29.35.png

  2. 右上の"Search or Enter Package URL"へ https://github.com/realm/SwiftLint を追加
    image.png

  3. "Add Package"を押下する

  4. "Add to Target"をどちらもNoneにする

"None"にしないと後程の手順でビルドエラー頻発します!!

image.png
5. "Add Package"を押下する
6. ルートプロジェクトを押下
7. SwiftLintを適用したいTARGETSを押下
8. "Build Phases"を開く
9. "Run build Tool Plug-ins"を開く
image.png
10. "+"アイコンを押下
11. "SwiftLintBuildToolPlugin"を選択し、"Add"を押下
image.png
12. 静的解析に引っかかりそうな命名などを行いビルドしてエラーが発生したら成功
image.png

まとめ

規約については、.swiftlint.ymlを使用すれば変更が可能。

SwiftLintの導入は意外と難しい。
特に、手順4の際、普段通りTargetを指定してしまうと解決に非常に時間を要する。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?