我在 Xcode 上使用的设置为 SwiftLint
运行以下脚本
if which $PATH/swiftlint >/dev/null; then
$PATH/swiftlint
elif which $HOME/.brew/bin/swiftlint >/dev/null; then
$HOME/.brew/bin/swiftlint
elif which ~/Softwares/homebrew/bin/swiftlint >/dev/null; then
~/Softwares/homebrew/bin/swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
我无法使用pods
或brew。
为了使 SwiftLint 可用,我使用以下命令将以下内容添加到我的路径中
vim ~/.bash_profile
export PATH
export PATH=$PATH:/Users/me/Documents/SwiftLint
我现在可以通过命令行在任何地方访问 SwiftLint
。
但是,Xcode 仍然显示未安装 SwiftLint 的消息。
我无法使用其他方法来安装 Swiftlint 或更改脚本。我猜我的导出路径有问题 - 这是什么问题?
最佳答案
运行脚本时,将不考虑.bash_profile
。我会像这样添加你的脚本:
if test -d "${HOME}/Documents/SwiftLint"; then
PATH="${HOME}/Documents/SwiftLint:${PATH}"
fi
export PATH
if ! which swiftlint >/dev/null 2>&1; then
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint" >&2
fi
关于使用 Xcode 设置 SwiftLint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58741453/