SucceedsPostAction.sh
is a bash script to be used as a 'Succeeds' post action in Xcode. This convenient script will automatically trigger SwiftLint when you compile a Swift Package.
At the moment you can't easily trigger SwiftLint when compiling a Swift Package. Swift 5.6 (not yet available at this time) might help thanks to SE-0303: Package Manager Extensible Build Tools. This script can be used in the meantime to help develop your Swift packages.
- Xcode 13.0 or later
- SwiftLint installed at
/usr/local/bin/swiftlint
- Download the script SucceedsPostAction.sh on your Mac.
- Ensure that the script has the proper permissions, i.e. run
chmod 755 SucceedsPostAction.sh
. - If you want to use custom SwiftLint rules, add the
.swiftlint.yml
file next to the script. - Launch Xcode 13.0 or later
- Open Preferences > Locations and ensure that
Command Line Tools
is set to an Xcode version - Open Preferences > Behaviors > Succeeds
- Choose the script
SucceedsPostAction.sh
That's it: each time you compile a Swift Package, the SucceedsPostAction.sh
will run SwiftLint.
A post action script running in Xcode can't add a log, a warning or an error to the Xcode build results. As a consequence, SucceedsPostAction.sh
opens a text file as a new window in Xcode with the list of SwiftLint reports. There is no deep integration to easily jump to the SwiftLint warnings. Once SE-0303: Package Manager Extensible Build Tools is integrated, this script shouldn't be needed anymore.
Eimy is looking for SwiftUI experts to grow our truly usable consumer products team:
- ❤️ SwiftUI
- 🤓 State-of-the-art apps
- ✨ Innovative consumer products
- 🛠 Experienced team
- 📍 Munich, Germany