Skip to content

Conversation

@maatheusgois-dd
Copy link

@maatheusgois-dd maatheusgois-dd commented May 27, 2025

📋 Summary

This PR introduces comprehensive Swift Package Manager (SPM) support to SweetPad and significantly improves the development workflow with intelligent tooling and enhanced developer experience.

_SPM.mp4

Major Features

🔧 Complete Swift Package Manager Integration

  • 📦 Package.swift Detection: Automatically recognizes SPM projects alongside Xcode workspaces
  • 🎯 Smart Scheme Detection: Extracts schemes from SPM products and targets without duplicates
  • ⚡ SPM-Optimized Commands: Uses appropriate swift package and xcodebuild commands for SPM projects
  • 🧪 Full Testing Support: Complete build-for-testing and test execution for SPM packages
  • 🔗 Dependency Management: Handles SPM dependencies with swift package resolve

🛠️ Enhanced Development Workflow

  • 🤖 Smart Editor Detection: Automatically detects and uses Cursor or VS Code
  • 📊 Dynamic Versioning: All scripts now read version from package.json automatically
  • 🔄 Auto Window Reload: Automatically reloads editor window after extension installation
  • ✨ Improved Logging: Beautiful, informative progress indicators throughout the process
  • 📚 Comprehensive Documentation: Added detailed development setup guide to README

🔧 Technical Implementation

Core Architecture Changes:

// SPM Detection & Handling
src/build/utils.ts          // Added SPM workspace detection
src/common/cli/scripts.ts   // SPM-aware command generation  
src/build/commands.ts       // SPM build command support
src/testing/manager.ts      // SPM testing integration

Key Features:

  1. 🔍 Project Type Detection: Distinguishes between .xcworkspace and Package.swift
  2. ⚙️ Command Adaptation: Uses correct xcodebuild arguments for each project type
  3. 🏗️ Build Settings: Proper build settings extraction for SPM projects
  4. 🎯 Target Management: Handles SPM targets and products correctly

Enhanced Tooling:

# Smart installation script
scripts/install-and-test.sh  # Auto-detects Cursor/VS Code, dynamic versioning

🧪 Testing & Validation

  • SPM Project Testing: Verified with tests/examples/sweetpad-spm
  • Build & Test Commands: All SPM operations working correctly
  • Backward Compatibility: No regression with existing Xcode projects
  • Cross-Editor Support: Tested with both VS Code and Cursor
  • Installation Workflow: Automated testing of build → package → install → reload

📱 Project Support Matrix

Project Type Detection Build Test Debug Status
Xcode Workspace Existing
Xcode Project Existing
SPM Package New

🎯 Developer Experience Improvements

Before:

# Manual process
npm run build
./scripts/create-vsix.sh
code --install-extension sweetpad-0.1.66.vsix  # Hardcoded version
# Manual window reload required

After:

# One command does everything
./scripts/install-and-test.sh

# Output:
# 📋 Using version: 0.1.67
# 📝 Using Cursor (cursor)
# ✅ Extension installed successfully in Cursor!
# 🔄 Reloading Cursor window...
# 🎉 SweetPad is ready to use in Cursor!

📚 Documentation Updates

  • 🛠️ Development Section: Complete local development setup guide
  • 📦 SPM Support: Documentation for Swift Package Manager projects
  • ⚡ Quick Start: Streamlined contributor onboarding
  • 🔧 Manual Alternatives: Fallback instructions for different workflows

🔄 Backward Compatibility

  • 100% Compatible: All existing Xcode workspace functionality preserved
  • No Breaking Changes: Existing configurations work unchanged
  • Graceful Fallbacks: SPM detection doesn't interfere with Xcode projects

🎉 Impact

This PR transforms SweetPad from an Xcode-only tool to a comprehensive Swift development environment supporting the entire Swift ecosystem:

  • 📈 Broader Adoption: Now supports modern SPM-based Swift development
  • ⚡ Faster Development: Streamlined build and test workflow
  • 🎯 Better UX: Intelligent tooling that "just works"
  • 🔧 Easier Contributing: One-command setup for contributors

🔗 Related Issues: Resolves SPM support requests and improves development workflow

🧪 Test Instructions:

  1. Run ./scripts/install-and-test.sh
  2. Open tests/examples/sweetpad-spm
  3. Try build, test, and run commands
  4. Verify extension works in both Cursor and VS Code

This PR significantly expands SweetPad's capabilities while maintaining the excellent developer experience that makes it a true Xcode alternative! 🚀

@maatheusgois-dd maatheusgois-dd marked this pull request as draft May 27, 2025 04:18
@maatheusgois-dd maatheusgois-dd marked this pull request as ready for review May 27, 2025 04:52
@hyzyla
Copy link
Collaborator

hyzyla commented Jun 1, 2025

thanks! look huge! I need some time to process and review, but I'll try to find that time next week 🏃🔥

@wdlgame
Copy link

wdlgame commented Jul 8, 2025

Has there been any progress on this?

callback: async (terminal) => {
try {
// Handle SPM projects
if (options.xcworkspace.endsWith("Package.swift")) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably refactor options.xcworkspace.endsWith("Package.swift") into a semantic isSPMProject like you did in the commands.ts file

@rudrankriyam
Copy link

Waiting for this!

@mtdev94
Copy link

mtdev94 commented Jan 15, 2026

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants