m2 - forceUnwrap https://forceunwrap.com Lift your Swift skills & career to the next level Fri, 29 Sep 2023 19:58:37 +0000 en-US hourly 1 https://wordpress.org/?v=7.0 https://forceunwrap.com/wp-content/uploads/2023/03/cropped-ForceUnwrap-32x32.jpg m2 - forceUnwrap https://forceunwrap.com 32 32 SwiftLint on Apple Silicon M1 https://forceunwrap.com/swiftlint-on-apple-silicon-m1/ https://forceunwrap.com/swiftlint-on-apple-silicon-m1/#respond Sun, 12 Jun 2022 19:56:22 +0000 https://forceunwrap.com/?p=157 If you want to install SwiftLint, you can do so by running the following command in your terminal:

brew install swiftlint

Once you’ve installed SwiftLint, you can check where it’s located on your system by running:

which swiftlint
// For Apple Silicon -> /opt/homebrew/bin/swiftlint

If you’re using an Apple Silicon chip, SwiftLint may be located in the /opt/homebrew/bin directory. To ensure that SwiftLint is available in your build phases, you’ll need to add the following script to your Run Script phase:

# Build Phases -> Run script phase for Apple Silicon chips
# Adds support for Apple Silicon brew directory
export PATH="$PATH:/opt/homebrew/bin"

if which swiftlint; then
    swiftlint autocorrect && swiftlint
else
  echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

This script adds support for the Apple Silicon brew directory and checks if SwiftLint is installed. If SwiftLint is installed, it will autocorrect and run it. Otherwise, it will display a warning message and provide a link to download SwiftLint from GitHub.

For those who wish to bypass the autocorrect function, simply replace swiftlint autocorrect && swiftlint with swiftlint.

If you encounter the error Sandbox: swiftlint(xxxxx) deny(1) file-read-data xxx /.swiftlint, navigate to Build settings and set the User Script Sandboxing value to “No”.

The post SwiftLint on Apple Silicon M1 first appeared on forceUnwrap.

]]>
https://forceunwrap.com/swiftlint-on-apple-silicon-m1/feed/ 0