# iOS Share Extension - Git Commit Guide

**Date:** 2025-01-27  
**Purpose:** Clarify which Xcode manual changes should be committed to the repository

## Quick Answer

**YES, most manual Xcode changes SHOULD be committed.** The only exceptions are user-specific settings that are already gitignored.

## What Gets Modified (and Should Be Committed)

When you create the Share Extension target and configure App Groups in Xcode, the following files are modified:

### 1. `ios/App/App.xcodeproj/project.pbxproj` ✅ **COMMIT THIS**

This is the main Xcode project file that tracks:
- **New targets** (Share Extension target)
- **File references** (which files belong to which targets)
- **Build settings** (compiler flags, deployment targets, etc.)
- **Build phases** (compile sources, link frameworks, etc.)
- **Capabilities** (App Groups configuration)
- **Target dependencies**

**This file IS tracked in git** (not in `.gitignore`), so changes should be committed.

### 2. Entitlements Files ✅ **COMMIT THESE**

When you enable App Groups capability, Xcode creates/modifies:
- `ios/App/App/App.entitlements` (for main app)
- `ios/App/TimeSafariShareExtension/TimeSafariShareExtension.entitlements` (for extension)

These files contain the App Group identifiers and should be committed.

### 3. Share Extension Source Files ✅ **ALREADY COMMITTED**

The following files are already in the repo:
- `ios/App/TimeSafariShareExtension/ShareViewController.swift`
- `ios/App/TimeSafariShareExtension/Info.plist`
- `ios/App/App/ShareImageBridge.swift`

These should already be committed (they were created as part of the implementation).

## What Should NOT Be Committed

### 1. User-Specific Settings ❌ **ALREADY GITIGNORED**

These are in `ios/.gitignore`:
- `xcuserdata/` - User-specific scheme selections, breakpoints, etc.
- `*.xcuserstate` - User's current Xcode state

### 2. Signing Identities ❌ **USER-SPECIFIC**

While the **App Groups capability** should be committed (it's in `project.pbxproj` and entitlements), your **personal signing identity/team** is user-specific and Xcode handles this automatically per developer.

## What Happens When You Commit

When you commit the changes:

1. **Other developers** who pull the changes will:
   - ✅ Get the new Share Extension target automatically
   - ✅ Get the App Groups capability configuration
   - ✅ Get file references and build settings
   - ✅ See the Share Extension in their Xcode project

2. **They will still need to:**
   - Configure their own signing team/identity (Xcode prompts for this)
   - Build the project (which may trigger CocoaPods updates)
   - But they **won't** need to manually create the target or configure App Groups

## Step-by-Step: What to Commit

After completing the Xcode setup steps:

```bash
# Check what changed
git status

# You should see:
# - ios/App/App.xcodeproj/project.pbxproj (modified)
# - ios/App/App/App.entitlements (new or modified)
# - ios/App/TimeSafariShareExtension/TimeSafariShareExtension.entitlements (new)
# - Possibly other project-related files

# Review the changes
git diff ios/App/App.xcodeproj/project.pbxproj

# Commit the changes
git add ios/App/App.xcodeproj/project.pbxproj
git add ios/App/App/App.entitlements
git add ios/App/TimeSafariShareExtension/TimeSafariShareExtension.entitlements
git commit -m "Add iOS Share Extension target and App Groups configuration"
```

## Important Notes

### Merge Conflicts in project.pbxproj

The `project.pbxproj` file can have merge conflicts because:
- It's auto-generated by Xcode
- Multiple developers might modify it
- It uses UUIDs that can conflict

**If you get merge conflicts:**
1. Open the project in Xcode
2. Xcode will often auto-resolve conflicts
3. Or manually resolve by keeping both sets of changes
4. Test that the project builds

### Team/Developer IDs

The `DEVELOPMENT_TEAM` setting in `project.pbxproj` might be user-specific:
- Some teams commit this (if everyone uses the same team)
- Some teams use `.xcconfig` files to override per developer
- Check with your team's practices

If you see `DEVELOPMENT_TEAM = GM3FS5JQPH;` in the project file, this is already committed, so your team likely commits team IDs.

## Verification

After committing, verify that:
1. The Share Extension target appears in Xcode for other developers
2. App Groups capability is configured
3. The project builds successfully
4. No user-specific files were accidentally committed

## Summary

| Change Type | Commit? | Reason |
|------------|---------|--------|
| New target creation | ✅ Yes | Modifies `project.pbxproj` |
| App Groups capability | ✅ Yes | Creates/modifies entitlements files |
| File target membership | ✅ Yes | Modifies `project.pbxproj` |
| Build settings | ✅ Yes | Modifies `project.pbxproj` |
| Source files (Swift, plist) | ✅ Yes | Already in repo |
| User scheme selections | ❌ No | In `xcuserdata/` (gitignored) |
| Personal signing identity | ⚠️ Maybe | Depends on team practice |

**Bottom line:** Commit all the Xcode project configuration changes. Other developers will get the Share Extension target automatically when they pull, and they'll only need to configure their personal signing settings.

