I'm trying to run a playground in my project. The problem being that the project contains thousands of files that are tightly coupled. I've created a cocoa touch framework that I can import to utilize the apps source in the playground. The only problem being that clicking on each source file and adding it to the target will take hours. Even when selecting multiple files. (if you select across groups the add to target option isn't available).
Is there a way to use Ruby's xcodeproj library to add all files programmatically? I'm not familiar with Ruby or that library and so discovering the precise code for this would be prohibitively time consuming. If not that, is there a way to effectively add all files in my workspace to this new framework through Xcode's UI itself?
If adding the entirety of the workspaces source to a framework turns out not to be a viable solution for other reasons, is there some way of getting a playground (with access to the app source) operational in this workspace?
It looks as if the new_file
method does what you need. There's an issue on GitHub that shows how to recursively go through a directory and add files to a target:
def addfiles (direc, current_group, main_target) Dir.glob(direc) do |item| next if item == '.' or item == '.DS_Store' if File.directory?(item) new_folder = File.basename(item) created_group = current_group.new_group(new_folder) addfiles("#{item}/*", created_group, main_target) else i = current_group.new_file(item) if item.include? ".m" main_target.add_file_references([i]) end end end end
It's not perfect. Some file names might include ".m" without having an 'm' extension, for instance. But the basic idea of using recursion is sound.