diff --git a/lib/xcodeproj/project/object/native_target.rb b/lib/xcodeproj/project/object/native_target.rb index b9d36641f..a8b4f9234 100644 --- a/lib/xcodeproj/project/object/native_target.rb +++ b/lib/xcodeproj/project/object/native_target.rb @@ -536,6 +536,22 @@ def add_file_references(file_references, compiler_flags = {}) end end + # Removes source files from the target. + # + # @param [Array] file_references + # the files references of the source files that should be removed + # from the target. + # + def remove_file_references(file_references) + file_references.map do |file| + extension = File.extname(file.path).downcase + header_extensions = Constants::HEADER_FILES_EXTENSIONS + is_header_phase = header_extensions.include?(extension) + phase = is_header_phase ? headers_build_phase : source_build_phase + phase.remove_file_reference(file) + end + end + # Adds resource files to the resources build phase of the target. # # @param [Array] resource_file_references