I'm writing more and more Swift CLI apps these days. And as I solve more problems with these little tools, I find that I'm copying the same code and utilities from one project to the next. Also, I'm importing the same packages over and over. So I wanted to automate the creation of macOS Swift CLI Projects, and have kind of a "starter template Swift-based CLI Xcode Project"
This template uses Tuist to generate the project, so you need:
xcode-select -p prints the path to the Command Line Tools active. In Xcode Settings you can change the active ones.tuist update.git clone https://github.com/dfreniche/SwiftCLITemplatemv SwiftCLITemplate MyCLIAppcd SwiftCLITemplate (or if you renamed, cd MyCLIApp)Project.swifttuist generateA simple CLI macOS App with an async starting point AsyncMainCLI.swift. It downloads an image and shows it using open. Review the code in Sources folder.
tuist fetch && tuist generate --no-cache
"error: 'swiftpackagemanager': Invalid manifest"Apparently, after installing Xcode 14 on macOS Monterrey (12.6), Xcode path was incorrect:
Fixed it with the command:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Source: issue
11 commits
1 commits
Swift
100.0%
I'm writing more and more Swift CLI apps these days. And as I solve more problems with these little tools, I find that I'm copying the same code and utilities from one project to the next. Also, I'm importing the same packages over and over. So I wanted to automate the creation of macOS Swift CLI Projects, and have kind of a "starter template Swift-based CLI Xcode Project"
This template uses Tuist to generate the project, so you need:
xcode-select -p prints the path to the Command Line Tools active. In Xcode Settings you can change the active ones.tuist update.git clone https://github.com/dfreniche/SwiftCLITemplatemv SwiftCLITemplate MyCLIAppcd SwiftCLITemplate (or if you renamed, cd MyCLIApp)Project.swifttuist generateA simple CLI macOS App with an async starting point AsyncMainCLI.swift. It downloads an image and shows it using open. Review the code in Sources folder.
tuist fetch && tuist generate --no-cache
"error: 'swiftpackagemanager': Invalid manifest"Apparently, after installing Xcode 14 on macOS Monterrey (12.6), Xcode path was incorrect:
Fixed it with the command:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Source: issue
11 commits
1 commits
Swift
100.0%