Search code examples
xcodeframeworksgit-commit

How to commit code separately for app project with nested framework project in Xcode


I used the instructions in Apps with Multiple Xcode Projects to set up an app project with a nested framework project in Xcode. The project navigator looks like this:

App project with nested framework project

When I make changes to files in the framework and/or files in the app, clicking on Source Control > Commit in the Xcode menu brings up the Commit window showing all the files I have modified (both the app and the framework) with a checkbox next to them.

How can I commit files for the app and the framework separately? Whatever commit message I write would be applied to both projects in the commit, which wouldn't be correct. What is the proper thing to do?


Solution

  • After struggling with this for a couple of weeks, I just found out the answer on my own.

    Using the example where an app project (MyApp) has a nested framework project (MyFramework.xcodeproj):

    App project with nested framework project

    if you made changes to both the app project as well as the framework project, clicking on Source Control > Commit in the Xcode menu brings up the Commit window showing all the files with a checkbox next to them. This means that the commit message will apply to both the app project and the framework project, which wouldn't be correct!

    The way to commit the modified files in the framework project separately (using the example above) is to Ctrl-click on MyFramework (yellow folder) under MyFramework.xcodeproj in the project navigator. In the menu that pops up, click on Source Control > Commit n files:

    project-specific popup menu

    The Commit window appears showing all the files in both the app project and the framework project, BUT only the files in MyFramework project that need to be committed are pre-selected. Add the Commit message appropriate to the framework project and commit the files.

    Repeat by Ctrl-click'ing on MyApp (yellow folder) in the project navigator and then clicking on Source Control > Commit n files...