Skip to content

Instantly share code, notes, and snippets.

@antonfdiaz
Created August 27, 2025 09:56
Show Gist options
  • Select an option

  • Save antonfdiaz/471cc6cfd119e510561e7933cfd98bca to your computer and use it in GitHub Desktop.

Select an option

Save antonfdiaz/471cc6cfd119e510561e7933cfd98bca to your computer and use it in GitHub Desktop.
Swift UI project creator (to build without Xcode)
#!/bin/bash
echo "----- SwiftUI Project Creator -----"
read -p "Project name: " projname
read -p "Version: " version
read -p "Bundle ID: " bundleid
if [[ -z "$projname" || -z "$version" || -z "$bundleid" ]]; then
echo "Error: All fields must be filled."
exit 1
fi
echo "Creating project..."
mkdir "$projname" || { echo "Failed to create project directory."; exit 1; }
cd "$projname" || exit 1
cat > main.swift <<EOF
import SwiftUI
@main
struct ${projname}App: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
EOF
cat > ContentView.swift <<EOF
import SwiftUI
struct ContentView: View {
var body: some View {
Text("Hello World!")
}
}
EOF
echo "Done. Downloading Makefile..."
curl -fLo Makefile https://x0.at/5hDN.txt
if [[ $? -ne 0 ]]; then
echo "Failed to download Makefile."
exit 1
fi
echo "Makefile downloaded. Editing..."
sed -i '' "s|__PROJNAME__|$projname|g" Makefile
sed -i '' "s|__BUNDLEID__|$bundleid|g" Makefile
sed -i '' "s|__VERSION__|$version|g" Makefile
echo "Creating project done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment