class Xcodeproj::Project::Object::PBXGroup

Public Instance Methods

new_file_with_uuid(path, uuid, source_tree = :group)
new_group_with_uuid(name, uuid, path = nil, source_tree = :group) click to toggle source

Creates a new group with given UUID.

@param [String] uuid UUID of the object.

# File lib/cocoaseeds/xcodehelper.rb, line 54
def new_group_with_uuid(name, uuid, path = nil, source_tree = :group)
  group = project.new_with_uuid(PBXGroup, uuid)
  children << group
  group.name = name
  group.set_source_tree(source_tree)
  group.set_path(path)
  group
end
new_reference_with_uuid(path, uuid, source_tree = :group) click to toggle source

Creates a file reference with given UUID.

@param [String] uuid UUID of the object.

# File lib/cocoaseeds/xcodehelper.rb, line 68
def new_reference_with_uuid(path, uuid, source_tree = :group)
  # customize `FileReferencesFactory.new_file_reference`
  path = Pathname.new(path)
  ref = self.project.new_with_uuid(PBXFileReference, uuid)
  self.children << ref
  GroupableHelper.set_path_with_source_tree(ref, path, source_tree)
  ref.set_last_known_file_type

  # customize `FileReferencesFactory.configure_defaults_for_file_reference`
  if ref.path.include?('/')
    ref.name = ref.path.split('/').last
  end
  if File.extname(ref.path).downcase == '.framework'
    ref.include_in_index = nil
  end

  ref
end
Also aliased as: new_file_with_uuid