Loading...
Loading...
REQUIRED: After creating ANY .swift, .m, .mm, .c, .cpp, or .h file in a directory containing a .xcodeproj, you MUST run add_to_xcode.rb to register it with the project. Without this step, the file will NOT appear in Xcode and will NOT compile.
npx skill4agent add michaelboeding/skills add-to-xcode.swift.m.mm.c.cpp.hruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb <filepath># ALWAYS do this after creating any source file:
# Use subshell to get latest version (handles multiple cached versions)
ruby "$(ls -1d ~/.claude/plugins/cache/michaelboeding-skills/skills/*/skills/add-to-xcode/scripts/add_to_xcode.rb 2>/dev/null | sort -V | tail -1)" NewFile.swift| Extension | Added to Compile Sources |
|---|---|
| ✅ Yes |
| ✅ Yes |
| ✅ Yes |
| ✅ Yes |
| ✅ Yes |
| ❌ No (reference only) |
# Example: Create a new Swift file
cat > Sources/Features/MyFeature.swift << 'EOF'
import Foundation
class MyFeature {
// Implementation
}
EOFruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb Sources/Features/MyFeature.swift✓ Added Sources/Features/MyFeature.swift to MyApp.xcodeproj (target: MyApp).xcodeproj.swift.m.mm.c.cppxcodeprojgem install xcodeproj# Create the file
cat > MyApp/ViewModels/ProfileViewModel.swift << 'EOF'
import SwiftUI
@Observable
class ProfileViewModel {
var name: String = ""
var email: String = ""
}
EOF
# Add to Xcode
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb MyApp/ViewModels/ProfileViewModel.swift# Create header
cat > MyApp/Bridge/MyApp-Bridging-Header.h << 'EOF'
#import <SomeLibrary/SomeLibrary.h>
EOF
# Add to Xcode (headers are added but not to compile sources)
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb MyApp/Bridge/MyApp-Bridging-Header.h# Create implementation
cat > MyApp/Legacy/LegacyManager.m << 'EOF'
#import "LegacyManager.h"
@implementation LegacyManager
// Implementation
@end
EOF
# Add to Xcode
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb MyApp/Legacy/LegacyManager.m.xcodeproj# Pattern for agents:
# 1. Create file
cat > NewFile.swift << 'EOF'
// content
EOF
# 2. Register with Xcode
ruby ${CLAUDE_PLUGIN_ROOT}/skills/add-to-xcode/scripts/add_to_xcode.rb NewFile.swiftgem install xcodeprojsudo gem install xcodeproj.swift.m.mm.c.cpp.h| Skill | Use Case |
|---|---|
| Convert iOS code to Android |
| Convert Android code to iOS |