Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save onmyway133/0e07a50423d02d5b17ed4cec65e076ea to your computer and use it in GitHub Desktop.
Save onmyway133/0e07a50423d02d5b17ed4cec65e076ea to your computer and use it in GitHub Desktop.
Example of how to use the ruby gem xcodeproj to add a library to the Frameworks group of a project. Forked and updated to work with updated version of xcodeproj.
require 'xcodeproj'
project_path = "your_project_path";
# Create project object
project = Xcodeproj::Project.new(project_path);
lib_path = "your_lib_path";
# Add the lib file as a reference
libRef = project['Frameworks'].new_file(lib_path);
# Get the build phase
framework_buildphase = project.objects.select{|x| x.class == Xcodeproj::Project::Object::PBXFrameworksBuildPhase}[0];
# Add it to the build phase
framework_buildphase.add_file_reference(libRef);
# Save the project
project.save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment