Repository: conan-io/conan
Pull request: Add components support in XcodeDeps
Changelog: Feature: Add components support in XcodeDeps.
Docs: https://github.com/conan-io/docs/pull/2560

Closes: https://github.com/conan-io/conan/issues/11125

Uses xcodegen instead of adding the xcode project file as a string.



Problem statement:
[feature] XCodeDeps support Conan Components
Currently the XcodeDeps is not supporting Conan components which is resulting in having all components added to the generated xcconfig context. It would be good to split the xcconfig creation in separate files per component to allow more granular selection of components to be utilised on consuming side.

Hints from issue discussion:
Same applies for MSBuildDeps, not split into components yet
Thanks @maikelvdh  for the suggestion, I'm adding this to the 1.49 milestone so that we can consider if components support for  both MSBuildDeps  and XcodeDeps could make it into that release.

Commit message: update test

Patch to review:
diff --git a/conan/tools/apple/xcodedeps.py b/conan/tools/apple/xcodedeps.py
index d31664465ae..6011e030bd7 100644
--- a/conan/tools/apple/xcodedeps.py
+++ b/conan/tools/apple/xcodedeps.py
@@ -17,6 +17,11 @@
 GLOBAL_XCCONFIG_FILENAME = "conan_config.xcconfig"
 
 
+def _format_name(name):
+    name = name.replace(".", "_").replace("-", "_")
+    return name.lower()
+
+
 def _xcconfig_settings_filename(settings):
     arch = settings.get_safe("arch")
     architecture = to_apple_arch(arch) or arch
@@ -25,8 +30,7 @@ def _xcconfig_settings_filename(settings):
              ("sdk name", settings.get_safe("os.sdk")),
              ("sdk version", settings.get_safe("os.sdk_version"))]
     name = "".join("_{}".format(v) for _, v in props if v is not None and v)
-    name = name.replace(".", "_").replace("-", "_")
-    return name.lower()
+    return _format_name(name)
 
 
 def _xcconfig_conditional(settings):
@@ -56,55 +60,55 @@ class XcodeDeps(object):
     general_name = "conandeps.xcconfig"
 
     _vars_xconfig = textwrap.dedent("""\
-        // Definition of Conan variables for {{name}}
-        CONAN_{{name}}_BINARY_DIRECTORIES{{condition}} = {{bin_dirs}}
-        CONAN_{{name}}_C_COMPILER_FLAGS{{condition}} = {{c_compiler_flags}}
-        CONAN_{{name}}_CXX_COMPILER_FLAGS{{condition}} = {{cxx_compiler_flags}}
-        CONAN_{{name}}_LINKER_FLAGS{{condition}} = {{linker_flags}}
-        CONAN_{{name}}_PREPROCESSOR_DEFINITIONS{{condition}} = {{definitions}}
-        CONAN_{{name}}_INCLUDE_DIRECTORIES{{condition}} = {{include_dirs}}
-        CONAN_{{name}}_RESOURCE_DIRECTORIES{{condition}} = {{res_dirs}}
-        CONAN_{{name}}_LIBRARY_DIRECTORIES{{condition}} = {{lib_dirs}}
-        CONAN_{{name}}_LIBRARIES{{condition}} = {{libs}}
-        CONAN_{{name}}_SYSTEM_LIBS{{condition}} = {{system_libs}}
-        CONAN_{{name}}_FRAMEWORKS_DIRECTORIES{{condition}} = {{frameworkdirs}}
-        CONAN_{{name}}_FRAMEWORKS{{condition}} = {{frameworks}}
+        // Definition of Conan variables for {{pkg_name}}::{{comp_name}}
+        CONAN_{{pkg_name}}_{{comp_name}}_BINARY_DIRECTORIES{{condition}} = {{bin_dirs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_C_COMPILER_FLAGS{{condition}} = {{c_compiler_flags}}
+        CONAN_{{pkg_name}}_{{comp_name}}_CXX_COMPILER_FLAGS{{condition}} = {{cxx_compiler_flags}}
+        CONAN_{{pkg_name}}_{{comp_name}}_LINKER_FLAGS{{condition}} = {{linker_flags}}
+        CONAN_{{pkg_name}}_{{comp_name}}_PREPROCESSOR_DEFINITIONS{{condition}} = {{definitions}}
+        CONAN_{{pkg_name}}_{{comp_name}}_INCLUDE_DIRECTORIES{{condition}} = {{include_dirs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_RESOURCE_DIRECTORIES{{condition}} = {{res_dirs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_LIBRARY_DIRECTORIES{{condition}} = {{lib_dirs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_LIBRARIES{{condition}} = {{libs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_SYSTEM_LIBS{{condition}} = {{system_libs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_FRAMEWORKS_DIRECTORIES{{condition}} = {{frameworkdirs}}
+        CONAN_{{pkg_name}}_{{comp_name}}_FRAMEWORKS{{condition}} = {{frameworks}}
         """)
 
     _conf_xconfig = textwrap.dedent("""\
-        // Include {{name}} vars
+        // Include {{pkg_name}}::{{comp_name}} vars
         #include "{{vars_filename}}"
 
-        // Compiler options for {{name}}
-        HEADER_SEARCH_PATHS_{{name}} = $(CONAN_{{name}}_INCLUDE_DIRECTORIES)
-        GCC_PREPROCESSOR_DEFINITIONS_{{name}} = $(CONAN_{{name}}_PREPROCESSOR_DEFINITIONS)
-        OTHER_CFLAGS_{{name}} = $(CONAN_{{name}}_C_COMPILER_FLAGS)
-        OTHER_CPLUSPLUSFLAGS_{{name}} = $(CONAN_{{name}}_CXX_COMPILER_FLAGS)
-        FRAMEWORK_SEARCH_PATHS_{{name}} = $(CONAN_{{name}}_FRAMEWORKS_DIRECTORIES)
+        // Compiler options for {{pkg_name}}::{{pkg_name}}
+        HEADER_SEARCH_PATHS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_INCLUDE_DIRECTORIES)
+        GCC_PREPROCESSOR_DEFINITIONS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_PREPROCESSOR_DEFINITIONS)
+        OTHER_CFLAGS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_C_COMPILER_FLAGS)
+        OTHER_CPLUSPLUSFLAGS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_CXX_COMPILER_FLAGS)
+        FRAMEWORK_SEARCH_PATHS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_FRAMEWORKS_DIRECTORIES)
 
         // Link options for {{name}}
-        LIBRARY_SEARCH_PATHS_{{name}} = $(CONAN_{{name}}_LIBRARY_DIRECTORIES)
-        OTHER_LDFLAGS_{{name}} = $(CONAN_{{name}}_LINKER_FLAGS) $(CONAN_{{name}}_LIBRARIES) $(CONAN_{{name}}_SYSTEM_LIBS) $(CONAN_{{name}}_FRAMEWORKS)
+        LIBRARY_SEARCH_PATHS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_LIBRARY_DIRECTORIES)
+        OTHER_LDFLAGS_{{pkg_name}}_{{comp_name}} = $(CONAN_{{pkg_name}}_{{comp_name}}_LINKER_FLAGS) $(CONAN_{{pkg_name}}_{{comp_name}}_LIBRARIES) $(CONAN_{{pkg_name}}_{{comp_name}}_SYSTEM_LIBS) $(CONAN_{{pkg_name}}_{{comp_name}}_FRAMEWORKS)
         """)
 
     _dep_xconfig = textwrap.dedent("""\
-        // Conan XcodeDeps generated file for {{name}}
+        // Conan XcodeDeps generated file for {{pkg_name}}::{{comp_name}}
         // Includes all configurations for each dependency
-        {% for dep in deps -%}
-        // Includes for {{dep}} dependency
-        #include "conan_{{dep}}.xcconfig"
-        {%- endfor %}
+        {% for dep in deps %}
+        // Includes for {{dep[0]}}::{{dep[1]}} dependency
+        #include "conan_{{dep[0]}}_{{dep[1]}}.xcconfig"
+        {% endfor %}
         #include "{{dep_xconfig_filename}}"
 
-        HEADER_SEARCH_PATHS = $(inherited) $(HEADER_SEARCH_PATHS_{{name}})
-        GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(GCC_PREPROCESSOR_DEFINITIONS_{{name}})
-        OTHER_CFLAGS = $(inherited) $(OTHER_CFLAGS_{{name}})
-        OTHER_CPLUSPLUSFLAGS = $(inherited) $(OTHER_CPLUSPLUSFLAGS_{{name}})
-        FRAMEWORK_SEARCH_PATHS = $(inherited) $(FRAMEWORK_SEARCH_PATHS_{{name}})
+        HEADER_SEARCH_PATHS = $(inherited) $(HEADER_SEARCH_PATHS_{{pkg_name}}_{{comp_name}})
+        GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(GCC_PREPROCESSOR_DEFINITIONS_{{pkg_name}}_{{comp_name}})
+        OTHER_CFLAGS = $(inherited) $(OTHER_CFLAGS_{{pkg_name}}_{{comp_name}})
+        OTHER_CPLUSPLUSFLAGS = $(inherited) $(OTHER_CPLUSPLUSFLAGS_{{pkg_name}}_{{comp_name}})
+        FRAMEWORK_SEARCH_PATHS = $(inherited) $(FRAMEWORK_SEARCH_PATHS_{{pkg_name}}_{{comp_name}})
 
-        // Link options for {{name}}
-        LIBRARY_SEARCH_PATHS = $(inherited) $(LIBRARY_SEARCH_PATHS_{{name}})
-        OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_{{name}})
+        // Link options for {{pkg_name}}_{{comp_name}}
+        LIBRARY_SEARCH_PATHS = $(inherited) $(LIBRARY_SEARCH_PATHS_{{pkg_name}}_{{comp_name}})
+        OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_{{pkg_name}}_{{comp_name}})
          """)
 
     _all_xconfig = textwrap.dedent("""\
@@ -112,6 +116,11 @@ class XcodeDeps(object):
         // Includes all direct dependencies
         """)
 
+    _pkg_xconfig = textwrap.dedent("""\
+        // Conan XcodeDeps generated file
+        // Includes all components for the package
+        """)
+
     def __init__(self, conanfile):
         self._conanfile = conanfile
         self.configuration = conanfile.settings.get_safe("build_type")
@@ -131,13 +140,14 @@ def generate(self):
         for generator_file, content in generator_files.items():
             save(generator_file, content)
 
-    def _vars_xconfig_file(self, dep, name, cpp_info):
+    def _vars_xconfig_file(self, pkg_name, comp_name, cpp_info):
         """
         returns a .xcconfig file with the variables definition for one package for one configuration
         """
 
         fields = {
-            'name': name,
+            'pkg_name': pkg_name,
+            'comp_name': comp_name,
             'bin_dirs': " ".join('"{}"'.format(p) for p in cpp_info.bindirs),
             'res_dirs': " ".join('"{}"'.format(p) for p in cpp_info.resdirs),
             'include_dirs': " ".join('"{}"'.format(p) for p in cpp_info.includedirs),
@@ -156,24 +166,26 @@ def _vars_xconfig_file(self, dep, name, cpp_info):
         formatted_template = Template(self._vars_xconfig).render(**fields)
         return formatted_template
 
-    def _conf_xconfig_file(self, dep_name, vars_xconfig_name):
+    def _conf_xconfig_file(self, pkg_name, comp_name, vars_xconfig_name):
         """
         content for conan_poco_x86_release.xcconfig, containing the activation
         """
         template = Template(self._conf_xconfig)
-        content_multi = template.render(name=dep_name, vars_filename=vars_xconfig_name)
+        content_multi = template.render(pkg_name=pkg_name, comp_name=comp_name,
+                                        vars_filename=vars_xconfig_name)
         return content_multi
 
-    def _dep_xconfig_file(self, name, name_general, dep_xconfig_filename, deps):
+    def _dep_xconfig_file(self, pkg_name, comp_name, name_general, dep_xconfig_filename, reqs):
         # Current directory is the generators_folder
         multi_path = name_general
         if os.path.isfile(multi_path):
             content_multi = load(multi_path)
         else:
             content_multi = self._dep_xconfig
-            content_multi = Template(content_multi).render({"name": name,
+            content_multi = Template(content_multi).render({"pkg_name": pkg_name,
+                                                            "comp_name": comp_name,
                                                             "dep_xconfig_filename": dep_xconfig_filename,
-                                                            "deps": deps})
+                                                            "deps": reqs})
 
         if dep_xconfig_filename not in content_multi:
             content_multi = content_multi.replace('.xcconfig"',
@@ -189,37 +201,73 @@ def _all_xconfig_file(self, deps):
         content_multi = self._all_xconfig
 
         for req, dep in deps.items():
-            dep_name = dep.ref.name.replace(".", "_").replace("-", "_")
+            dep_name = _format_name(dep.ref.name)
             content_multi = content_multi + '\n#include "conan_{}.xcconfig"\n'.format(dep_name)
         return content_multi
 
+    def _pkg_xconfig_file(self, components):
+        """
+        this is a .xcconfig file including the components for each package
+        """
+        content_multi = self._pkg_xconfig
+        for pkg_name, comp_name in components:
+            content_multi = content_multi + '\n#include "conan_{}_{}.xcconfig"\n'.format(pkg_name,
+                                                                                         comp_name)
+        return content_multi
+
     @property
     def _global_xconfig_content(self):
         return _add_includes_to_file_or_create(GLOBAL_XCCONFIG_FILENAME,
                                                GLOBAL_XCCONFIG_TEMPLATE,
                                                [self.general_name])
 
-    def _content(self):
+    def get_content_for_component(self, pkg_name, component_name, cpp_info, reqs):
         result = {}
+
         conf_name = _xcconfig_settings_filename(self._conanfile.settings)
+        # One file per configuration, with just the variables
+        vars_xconfig_name = "conan_{}_{}_vars{}.xcconfig".format(pkg_name, component_name, conf_name)
+        result[vars_xconfig_name] = self._vars_xconfig_file(pkg_name, component_name, cpp_info)
+
+        props_name = "conan_{}_{}{}.xcconfig".format(pkg_name, component_name, conf_name)
+        result[props_name] = self._conf_xconfig_file(pkg_name, component_name, vars_xconfig_name)
+
+        # The entry point for each package
+        file_dep_name = "conan_{}_{}.xcconfig".format(pkg_name, component_name)
+        dep_content = self._dep_xconfig_file(pkg_name, component_name, file_dep_name, props_name, reqs)
+
+        result[file_dep_name] = dep_content
+        return result
+
+    def _content(self):
+        result = {}
 
+        # Generate the config files for each component with name conan_pkgname_compname.xcconfig
+        # If a package has no components the name is conan_pkgname_pkgname.xcconfig
+        # Then all components are included in the conan_pkgname.xcconfig file
         for dep in self._conanfile.dependencies.host.values():
-            dep_name = dep.ref.name
-            dep_name = dep_name.replace(".", "_").replace("-", "_")
-            cpp_info = dep.cpp_info.aggregated_components()
-            public_deps = [d.ref.name.replace(".", "_").replace("-", "_")
-                           for r, d in dep.dependencies.direct_host.items() if r.visible]
-
-            # One file per configuration, with just the variables
-            vars_xconfig_name = "conan_{}_vars{}.xcconfig".format(dep_name, conf_name)
-            result[vars_xconfig_name] = self._vars_xconfig_file(dep, dep_name, cpp_info)
-            props_name = "conan_{}{}.xcconfig".format(dep_name, conf_name)
-            result[props_name] = self._conf_xconfig_file(dep_name, vars_xconfig_name)
-
-            # The entry point for each package
-            file_dep_name = "conan_{}.xcconfig".format(dep_name)
-            dep_content = self._dep_xconfig_file(dep_name, file_dep_name, props_name, public_deps)
-            result[file_dep_name] = dep_content
+            dep_name = _format_name(dep.ref.name)
+
+            include_components_names = []
+            if dep.cpp_info.has_components:
+                for comp_name, comp_cpp_info in dep.cpp_info.get_sorted_components().items():
+                    component_deps = []
+                    for req in comp_cpp_info.requires:
+                        req_pkg, req_cmp = req.split("::") if "::" in req else (dep_name, req)
+                        component_deps.append((req_pkg, req_cmp))
+
+                    component_content = self.get_content_for_component(dep_name, comp_name, comp_cpp_info, component_deps)
+                    include_components_names.append((dep_name, comp_name))
+                    result.update(component_content)
+            else:
+                public_deps = [(_format_name(d.ref.name),) * 2 for r, d in
+                               dep.dependencies.direct_host.items() if r.visible]
+                required_components = dep.cpp_info.required_components if dep.cpp_info.required_components else public_deps
+                root_content = self.get_content_for_component(dep_name, dep_name, dep.cpp_info, required_components)
+                include_components_names.append((dep_name, dep_name))
+                result.update(root_content)
+
+            result["conan_{}.xcconfig".format(dep_name)] = self._pkg_xconfig_file(include_components_names)
 
         # Include all direct build_requires for host context.
         direct_deps = self._conanfile.dependencies.filter({"direct": True, "build": False})
diff --git a/conans/test/conftest.py b/conans/test/conftest.py
index 6a1db19e7ae..ce8beaee20d 100644
--- a/conans/test/conftest.py
+++ b/conans/test/conftest.py
@@ -122,6 +122,7 @@
         }
     },
     'premake': {},
+    'xcodegen': {"platform": "Darwin"},
     'apt_get': {"exe": "apt-get"},
     'brew': {},
     'android_ndk': {
diff --git a/conans/test/functional/toolchains/apple/test_xcodebuild.py b/conans/test/functional/toolchains/apple/test_xcodebuild.py
index 8713f6594a3..7befb996088 100644
--- a/conans/test/functional/toolchains/apple/test_xcodebuild.py
+++ b/conans/test/functional/toolchains/apple/test_xcodebuild.py
@@ -5,305 +5,17 @@
 
 from conans.test.utils.tools import TestClient
 
-pbxproj = textwrap.dedent("""
-    // !$*UTF8*$!
-    {
-        archiveVersion = 1;
-        classes = {
-        };
-        objectVersion = 55;
-        objects = {
-
-    /* Begin PBXBuildFile section */
-            07879B4027219EE500B6FB51 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07879B3F27219EE500B6FB51 /* main.cpp */; };
-    /* End PBXBuildFile section */
-
-    /* Begin PBXCopyFilesBuildPhase section */
-            07879B3A27219EE500B6FB51 /* CopyFiles */ = {
-                isa = PBXCopyFilesBuildPhase;
-                buildActionMask = 2147483647;
-                dstPath = /usr/share/man/man1/;
-                dstSubfolderSpec = 0;
-                files = (
-                );
-                runOnlyForDeploymentPostprocessing = 1;
-            };
-    /* End PBXCopyFilesBuildPhase section */
-
-    /* Begin PBXFileReference section */
-            07879B3C27219EE500B6FB51 /* app */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = app; sourceTree = BUILT_PRODUCTS_DIR; };
-            07879B3F27219EE500B6FB51 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
-            41608B0827BBEB2800527FAA /* conandeps.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = conandeps.xcconfig; path = conandeps.xcconfig; sourceTree = SOURCE_ROOT; };
-            41608B0927BBEB2800527FAA /* conan_hello_vars_release_x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = conan_hello_vars_release_x86_64.xcconfig; path = conan_hello_vars_release_x86_64.xcconfig; sourceTree = SOURCE_ROOT; };
-            41608B0A27BBEB2900527FAA /* conan_hello_debug_x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = conan_hello_debug_x86_64.xcconfig; path = conan_hello_debug_x86_64.xcconfig; sourceTree = SOURCE_ROOT; };
-            41608B0B27BBEB2900527FAA /* conan_hello.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = conan_hello.xcconfig; path = conan_hello.xcconfig; sourceTree = SOURCE_ROOT; };
-            41608B0C27BBEB2900527FAA /* conan_hello_vars_debug_x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = conan_hello_vars_debug_x86_64.xcconfig; path = conan_hello_vars_debug_x86_64.xcconfig; sourceTree = SOURCE_ROOT; };
-            41608B0D27BBEB2900527FAA /* conan_hello_release_x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = conan_hello_release_x86_64.xcconfig; path = conan_hello_release_x86_64.xcconfig; sourceTree = SOURCE_ROOT; };
-    /* End PBXFileReference section */
-
-    /* Begin PBXFrameworksBuildPhase section */
-            07879B3927219EE500B6FB51 /* Frameworks */ = {
-                isa = PBXFrameworksBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXFrameworksBuildPhase section */
-
-    /* Begin PBXGroup section */
-            07879B3327219EE500B6FB51 = {
-                isa = PBXGroup;
-                children = (
-                    07879B3E27219EE500B6FB51 /* app */,
-                    07879B3D27219EE500B6FB51 /* Products */,
-                );
-                sourceTree = "<group>";
-            };
-            07879B3D27219EE500B6FB51 /* Products */ = {
-                isa = PBXGroup;
-                children = (
-                    07879B3C27219EE500B6FB51 /* app */,
-                );
-                name = Products;
-                sourceTree = "<group>";
-            };
-            07879B3E27219EE500B6FB51 /* app */ = {
-                isa = PBXGroup;
-                children = (
-                    41608B0A27BBEB2900527FAA /* conan_hello_debug_x86_64.xcconfig */,
-                    41608B0D27BBEB2900527FAA /* conan_hello_release_x86_64.xcconfig */,
-                    41608B0C27BBEB2900527FAA /* conan_hello_vars_debug_x86_64.xcconfig */,
-                    41608B0927BBEB2800527FAA /* conan_hello_vars_release_x86_64.xcconfig */,
-                    41608B0B27BBEB2900527FAA /* conan_hello.xcconfig */,
-                    41608B0827BBEB2800527FAA /* conandeps.xcconfig */,
-                    07879B3F27219EE500B6FB51 /* main.cpp */,
-                );
-                path = app;
-                sourceTree = "<group>";
-            };
-    /* End PBXGroup section */
-
-    /* Begin PBXNativeTarget section */
-            07879B3B27219EE500B6FB51 /* app */ = {
-                isa = PBXNativeTarget;
-                buildConfigurationList = 07879B4327219EE500B6FB51 /* Build configuration list for PBXNativeTarget "app" */;
-                buildPhases = (
-                    07879B3827219EE500B6FB51 /* Sources */,
-                    07879B3927219EE500B6FB51 /* Frameworks */,
-                    07879B3A27219EE500B6FB51 /* CopyFiles */,
-                );
-                buildRules = (
-                );
-                dependencies = (
-                );
-                name = app;
-                productName = app;
-                productReference = 07879B3C27219EE500B6FB51 /* app */;
-                productType = "com.apple.product-type.tool";
-            };
-    /* End PBXNativeTarget section */
-
-    /* Begin PBXProject section */
-            07879B3427219EE500B6FB51 /* Project object */ = {
-                isa = PBXProject;
-                attributes = {
-                    BuildIndependentTargetsInParallel = 1;
-                    LastUpgradeCheck = 1320;
-                    TargetAttributes = {
-                        07879B3B27219EE500B6FB51 = {
-                            CreatedOnToolsVersion = 13.0;
-                        };
-                    };
-                };
-                buildConfigurationList = 07879B3727219EE500B6FB51 /* Build configuration list for PBXProject "app" */;
-                compatibilityVersion = "Xcode 13.0";
-                developmentRegion = en;
-                hasScannedForEncodings = 0;
-                knownRegions = (
-                    en,
-                    Base,
-                );
-                mainGroup = 07879B3327219EE500B6FB51;
-                productRefGroup = 07879B3D27219EE500B6FB51 /* Products */;
-                projectDirPath = "";
-                projectRoot = "";
-                targets = (
-                    07879B3B27219EE500B6FB51 /* app */,
-                );
-            };
-    /* End PBXProject section */
-
-    /* Begin PBXSourcesBuildPhase section */
-            07879B3827219EE500B6FB51 /* Sources */ = {
-                isa = PBXSourcesBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                    07879B4027219EE500B6FB51 /* main.cpp in Sources */,
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXSourcesBuildPhase section */
-
-    /* Begin XCBuildConfiguration section */
-            07879B4127219EE500B6FB51 /* Debug */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 41608B0827BBEB2800527FAA /* conandeps.xcconfig */;
-                buildSettings = {
-                    ALWAYS_SEARCH_USER_PATHS = NO;
-                    CLANG_ANALYZER_NONNULL = YES;
-                    CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                    CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
-                    CLANG_CXX_LIBRARY = "libc++";
-                    CLANG_ENABLE_MODULES = YES;
-                    CLANG_ENABLE_OBJC_ARC = YES;
-                    CLANG_ENABLE_OBJC_WEAK = YES;
-                    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                    CLANG_WARN_BOOL_CONVERSION = YES;
-                    CLANG_WARN_COMMA = YES;
-                    CLANG_WARN_CONSTANT_CONVERSION = YES;
-                    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                    CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                    CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                    CLANG_WARN_EMPTY_BODY = YES;
-                    CLANG_WARN_ENUM_CONVERSION = YES;
-                    CLANG_WARN_INFINITE_RECURSION = YES;
-                    CLANG_WARN_INT_CONVERSION = YES;
-                    CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                    CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                    CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                    CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                    CLANG_WARN_STRICT_PROTOTYPES = YES;
-                    CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                    CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                    CLANG_WARN_UNREACHABLE_CODE = YES;
-                    CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                    COPY_PHASE_STRIP = NO;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    ENABLE_STRICT_OBJC_MSGSEND = YES;
-                    ENABLE_TESTABILITY = YES;
-                    GCC_C_LANGUAGE_STANDARD = gnu11;
-                    GCC_DYNAMIC_NO_PIC = NO;
-                    GCC_NO_COMMON_BLOCKS = YES;
-                    GCC_OPTIMIZATION_LEVEL = 0;
-                    GCC_PREPROCESSOR_DEFINITIONS = (
-                        "DEBUG=1",
-                        "$(inherited)",
-                    );
-                    GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                    GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                    GCC_WARN_UNDECLARED_SELECTOR = YES;
-                    GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                    GCC_WARN_UNUSED_FUNCTION = YES;
-                    GCC_WARN_UNUSED_VARIABLE = YES;
-                    MACOSX_DEPLOYMENT_TARGET = 11.3;
-                    MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
-                    MTL_FAST_MATH = YES;
-                    ONLY_ACTIVE_ARCH = YES;
-                    SDKROOT = macosx;
-                };
-                name = Debug;
-            };
-            07879B4227219EE500B6FB51 /* Release */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 41608B0827BBEB2800527FAA /* conandeps.xcconfig */;
-                buildSettings = {
-                    ALWAYS_SEARCH_USER_PATHS = NO;
-                    CLANG_ANALYZER_NONNULL = YES;
-                    CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                    CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
-                    CLANG_CXX_LIBRARY = "libc++";
-                    CLANG_ENABLE_MODULES = YES;
-                    CLANG_ENABLE_OBJC_ARC = YES;
-                    CLANG_ENABLE_OBJC_WEAK = YES;
-                    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                    CLANG_WARN_BOOL_CONVERSION = YES;
-                    CLANG_WARN_COMMA = YES;
-                    CLANG_WARN_CONSTANT_CONVERSION = YES;
-                    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                    CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                    CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                    CLANG_WARN_EMPTY_BODY = YES;
-                    CLANG_WARN_ENUM_CONVERSION = YES;
-                    CLANG_WARN_INFINITE_RECURSION = YES;
-                    CLANG_WARN_INT_CONVERSION = YES;
-                    CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                    CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                    CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                    CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                    CLANG_WARN_STRICT_PROTOTYPES = YES;
-                    CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                    CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                    CLANG_WARN_UNREACHABLE_CODE = YES;
-                    CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                    COPY_PHASE_STRIP = NO;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    ENABLE_NS_ASSERTIONS = NO;
-                    ENABLE_STRICT_OBJC_MSGSEND = YES;
-                    GCC_C_LANGUAGE_STANDARD = gnu11;
-                    GCC_NO_COMMON_BLOCKS = YES;
-                    GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                    GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                    GCC_WARN_UNDECLARED_SELECTOR = YES;
-                    GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                    GCC_WARN_UNUSED_FUNCTION = YES;
-                    GCC_WARN_UNUSED_VARIABLE = YES;
-                    MACOSX_DEPLOYMENT_TARGET = 11.3;
-                    MTL_ENABLE_DEBUG_INFO = NO;
-                    MTL_FAST_MATH = YES;
-                    SDKROOT = macosx;
-                };
-                name = Release;
-            };
-            07879B4427219EE500B6FB51 /* Debug */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 41608B0827BBEB2800527FAA /* conandeps.xcconfig */;
-                buildSettings = {
-                    CODE_SIGN_IDENTITY = "-";
-                    CODE_SIGN_STYLE = Automatic;
-                    PRODUCT_NAME = "$(TARGET_NAME)";
-                };
-                name = Debug;
-            };
-            07879B4527219EE500B6FB51 /* Release */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 41608B0827BBEB2800527FAA /* conandeps.xcconfig */;
-                buildSettings = {
-                    CODE_SIGN_IDENTITY = "-";
-                    CODE_SIGN_STYLE = Automatic;
-                    PRODUCT_NAME = "$(TARGET_NAME)";
-                };
-                name = Release;
-            };
-    /* End XCBuildConfiguration section */
-
-    /* Begin XCConfigurationList section */
-            07879B3727219EE500B6FB51 /* Build configuration list for PBXProject "app" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    07879B4127219EE500B6FB51 /* Debug */,
-                    07879B4227219EE500B6FB51 /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-            07879B4327219EE500B6FB51 /* Build configuration list for PBXNativeTarget "app" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    07879B4427219EE500B6FB51 /* Debug */,
-                    07879B4527219EE500B6FB51 /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-    /* End XCConfigurationList section */
-        };
-        rootObject = 07879B3427219EE500B6FB51 /* Project object */;
-    }
+xcode_project = textwrap.dedent("""
+    name: app
+    targets:
+      app:
+        type: tool
+        platform: macOS
+        sources:
+          - app
+        configFiles:
+          Debug: conan_config.xcconfig
+          Release: conan_config.xcconfig
     """)
 
 main = textwrap.dedent("""
@@ -342,11 +54,14 @@ def client():
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 def test_project_xcodebuild(client):
 
     conanfile = textwrap.dedent("""
+        import os
         from conans import ConanFile
         from conan.tools.apple import XcodeBuild
+        from conan.tools.files import copy
         class MyApplicationConan(ConanFile):
             name = "myapplication"
             version = "1.0"
@@ -359,7 +74,8 @@ def build(self):
                 xcode.build("app.xcodeproj")
 
             def package(self):
-                self.copy("*/app", dst="bin", src=".", keep_path=False)
+                copy(self, "build/{}/app".format(self.settings.build_type), self.source_folder,
+                     os.path.join(self.package_folder, "bin"), keep_path=False)
 
             def package_info(self):
                 self.cpp_info.bindirs = ["bin"]
@@ -368,7 +84,10 @@ def package_info(self):
     client.save({"conanfile.py": conanfile,
                  "test_package/conanfile.py": test,
                  "app/main.cpp": main,
-                 "app.xcodeproj/project.pbxproj": pbxproj}, clean_first=True)
+                 "project.yml": xcode_project}, clean_first=True)
+    client.run("install . --build=missing")
+    client.run("install . -s build_type=Debug --build=missing")
+    client.run_command("xcodegen generate")
     client.run("create . --build=missing")
     assert "hello/0.1: Hello World Release!" in client.out
     assert "App Release!" in client.out
@@ -379,6 +98,7 @@ def package_info(self):
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 @pytest.mark.skip(reason="Different sdks not installed in CI")
 def test_xcodebuild_test_different_sdk(client):
 
@@ -400,7 +120,10 @@ def build(self):
 
     client.save({"conanfile.py": conanfile,
                  "app/main.cpp": main,
-                 "app.xcodeproj/project.pbxproj": pbxproj}, clean_first=True)
+                 "project.yml": xcode_project}, clean_first=True)
+    client.run("install . --build=missing")
+    client.run("install . -s build_type=Debug --build=missing")
+    client.run_command("xcodegen generate")
     client.run("create . --build=missing -s os.sdk=macosx -s os.sdk_version=10.15 "
                "-c tools.apple:sdk_path='/Applications/Xcode11.7.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk'")
     assert "sdk 10.15.6" in client.out
@@ -411,6 +134,7 @@ def build(self):
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 def test_missing_sdk(client):
 
     conanfile = textwrap.dedent("""
@@ -430,6 +154,9 @@ def build(self):
 
     client.save({"conanfile.py": conanfile,
                  "app/main.cpp": main,
-                 "app.xcodeproj/project.pbxproj": pbxproj}, clean_first=True)
+                 "project.yml": xcode_project}, clean_first=True)
+    client.run("install . --build=missing")
+    client.run("install . -s build_type=Debug --build=missing")
+    client.run_command("xcodegen generate")
     client.run("create . --build=missing -s os.sdk=macosx -s os.sdk_version=12.0 "
                "-c tools.apple:sdk_path=notexistingsdk", assert_error=True)
diff --git a/conans/test/functional/toolchains/apple/test_xcodebuild_targets.py b/conans/test/functional/toolchains/apple/test_xcodebuild_targets.py
index a9ef1fbf7b2..41e6092b1c0 100644
--- a/conans/test/functional/toolchains/apple/test_xcodebuild_targets.py
+++ b/conans/test/functional/toolchains/apple/test_xcodebuild_targets.py
@@ -5,389 +5,26 @@
 
 from conans.test.utils.tools import TestClient
 
-pbxproj = textwrap.dedent("""
-    // !$*UTF8*$!
-    {
-        archiveVersion = 1;
-        classes = {
-        };
-        objectVersion = 55;
-        objects = {
-
-    /* Begin PBXBuildFile section */
-            4102E02127E0F84800A6AD9D /* hello.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4102E01F27E0F84800A6AD9D /* hello.cpp */; };
-            4102E02227E0F84800A6AD9D /* hello.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4102E02027E0F84800A6AD9D /* hello.hpp */; };
-            4102E03627E1027F00A6AD9D /* hello.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 4102E02027E0F84800A6AD9D /* hello.hpp */; };
-            4102E03827E1027F00A6AD9D /* hello.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4102E01F27E0F84800A6AD9D /* hello.cpp */; };
-    /* End PBXBuildFile section */
-
-    /* Begin PBXFileReference section */
-            4102E01827E0F83900A6AD9D /* libhello.dylib */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libhello.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
-            4102E01F27E0F84800A6AD9D /* hello.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = hello.cpp; sourceTree = "<group>"; };
-            4102E02027E0F84800A6AD9D /* hello.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = hello.hpp; sourceTree = "<group>"; };
-            4102E03D27E1027F00A6AD9D /* libhello.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libhello.a; sourceTree = BUILT_PRODUCTS_DIR; };
-            4102E03E27E1CEB000A6AD9D /* conan_config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_config.xcconfig; sourceTree = "<group>"; };
-            4102E03F27E1CEB000A6AD9D /* conantoolchain_release_x86_64.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conantoolchain_release_x86_64.xcconfig; sourceTree = "<group>"; };
-            4102E04027E1CEB000A6AD9D /* conantoolchain.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conantoolchain.xcconfig; sourceTree = "<group>"; };
-    /* End PBXFileReference section */
-
-    /* Begin PBXFrameworksBuildPhase section */
-            4102E01627E0F83900A6AD9D /* Frameworks */ = {
-                isa = PBXFrameworksBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-            4102E03927E1027F00A6AD9D /* Frameworks */ = {
-                isa = PBXFrameworksBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXFrameworksBuildPhase section */
-
-    /* Begin PBXGroup section */
-            4102E00F27E0F83900A6AD9D = {
-                isa = PBXGroup;
-                children = (
-                    4102E03E27E1CEB000A6AD9D /* conan_config.xcconfig */,
-                    4102E03F27E1CEB000A6AD9D /* conantoolchain_release_x86_64.xcconfig */,
-                    4102E04027E1CEB000A6AD9D /* conantoolchain.xcconfig */,
-                    4102E02327E0F99200A6AD9D /* src */,
-                    4102E01927E0F83900A6AD9D /* Products */,
-                );
-                sourceTree = "<group>";
-            };
-            4102E01927E0F83900A6AD9D /* Products */ = {
-                isa = PBXGroup;
-                children = (
-                    4102E01827E0F83900A6AD9D /* libhello.dylib */,
-                    4102E03D27E1027F00A6AD9D /* libhello.a */,
-                );
-                name = Products;
-                sourceTree = "<group>";
-            };
-            4102E02327E0F99200A6AD9D /* src */ = {
-                isa = PBXGroup;
-                children = (
-                    4102E01F27E0F84800A6AD9D /* hello.cpp */,
-                    4102E02027E0F84800A6AD9D /* hello.hpp */,
-                );
-                path = src;
-                sourceTree = "<group>";
-            };
-    /* End PBXGroup section */
-
-    /* Begin PBXHeadersBuildPhase section */
-            4102E01427E0F83900A6AD9D /* Headers */ = {
-                isa = PBXHeadersBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                    4102E02227E0F84800A6AD9D /* hello.hpp in Headers */,
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-            4102E03527E1027F00A6AD9D /* Headers */ = {
-                isa = PBXHeadersBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                    4102E03627E1027F00A6AD9D /* hello.hpp in Headers */,
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXHeadersBuildPhase section */
-
-    /* Begin PBXNativeTarget section */
-            4102E01727E0F83900A6AD9D /* hello-dynamic */ = {
-                isa = PBXNativeTarget;
-                buildConfigurationList = 4102E01C27E0F83900A6AD9D /* Build configuration list for PBXNativeTarget "hello-dynamic" */;
-                buildPhases = (
-                    4102E01427E0F83900A6AD9D /* Headers */,
-                    4102E01527E0F83900A6AD9D /* Sources */,
-                    4102E01627E0F83900A6AD9D /* Frameworks */,
-                );
-                buildRules = (
-                );
-                dependencies = (
-                );
-                name = "hello-dynamic";
-                productName = HelloLibrary;
-                productReference = 4102E01827E0F83900A6AD9D /* libhello.dylib */;
-                productType = "com.apple.product-type.library.static";
-            };
-            4102E03427E1027F00A6AD9D /* hello-static */ = {
-                isa = PBXNativeTarget;
-                buildConfigurationList = 4102E03A27E1027F00A6AD9D /* Build configuration list for PBXNativeTarget "hello-static" */;
-                buildPhases = (
-                    4102E03527E1027F00A6AD9D /* Headers */,
-                    4102E03727E1027F00A6AD9D /* Sources */,
-                    4102E03927E1027F00A6AD9D /* Frameworks */,
-                );
-                buildRules = (
-                );
-                dependencies = (
-                );
-                name = "hello-static";
-                productName = HelloLibrary;
-                productReference = 4102E03D27E1027F00A6AD9D /* libhello.a */;
-                productType = "com.apple.product-type.library.static";
-            };
-    /* End PBXNativeTarget section */
-
-    /* Begin PBXProject section */
-            4102E01027E0F83900A6AD9D /* Project object */ = {
-                isa = PBXProject;
-                attributes = {
-                    BuildIndependentTargetsInParallel = 1;
-                    LastUpgradeCheck = 1320;
-                    TargetAttributes = {
-                        4102E01727E0F83900A6AD9D = {
-                            CreatedOnToolsVersion = 13.2.1;
-                        };
-                    };
-                };
-                buildConfigurationList = 4102E01327E0F83900A6AD9D /* Build configuration list for PBXProject "HelloLibrary" */;
-                compatibilityVersion = "Xcode 13.0";
-                developmentRegion = en;
-                hasScannedForEncodings = 0;
-                knownRegions = (
-                    en,
-                    Base,
-                );
-                mainGroup = 4102E00F27E0F83900A6AD9D;
-                productRefGroup = 4102E01927E0F83900A6AD9D /* Products */;
-                projectDirPath = "";
-                projectRoot = "";
-                targets = (
-                    4102E01727E0F83900A6AD9D /* hello-dynamic */,
-                    4102E03427E1027F00A6AD9D /* hello-static */,
-                );
-            };
-    /* End PBXProject section */
-
-    /* Begin PBXSourcesBuildPhase section */
-            4102E01527E0F83900A6AD9D /* Sources */ = {
-                isa = PBXSourcesBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                    4102E02127E0F84800A6AD9D /* hello.cpp in Sources */,
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-            4102E03727E1027F00A6AD9D /* Sources */ = {
-                isa = PBXSourcesBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                    4102E03827E1027F00A6AD9D /* hello.cpp in Sources */,
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXSourcesBuildPhase section */
-
-    /* Begin XCBuildConfiguration section */
-            4102E01A27E0F83900A6AD9D /* Debug */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 4102E03E27E1CEB000A6AD9D /* conan_config.xcconfig */;
-                buildSettings = {
-                    ALWAYS_SEARCH_USER_PATHS = NO;
-                    CLANG_ANALYZER_NONNULL = YES;
-                    CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                    CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
-                    CLANG_CXX_LIBRARY = "libc++";
-                    CLANG_ENABLE_MODULES = YES;
-                    CLANG_ENABLE_OBJC_ARC = YES;
-                    CLANG_ENABLE_OBJC_WEAK = YES;
-                    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                    CLANG_WARN_BOOL_CONVERSION = YES;
-                    CLANG_WARN_COMMA = YES;
-                    CLANG_WARN_CONSTANT_CONVERSION = YES;
-                    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                    CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                    CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                    CLANG_WARN_EMPTY_BODY = YES;
-                    CLANG_WARN_ENUM_CONVERSION = YES;
-                    CLANG_WARN_INFINITE_RECURSION = YES;
-                    CLANG_WARN_INT_CONVERSION = YES;
-                    CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                    CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                    CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                    CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                    CLANG_WARN_STRICT_PROTOTYPES = YES;
-                    CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                    CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                    CLANG_WARN_UNREACHABLE_CODE = YES;
-                    CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                    COPY_PHASE_STRIP = NO;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    DEPLOYMENT_LOCATION = NO;
-                    ENABLE_STRICT_OBJC_MSGSEND = YES;
-                    ENABLE_TESTABILITY = YES;
-                    GCC_C_LANGUAGE_STANDARD = gnu11;
-                    GCC_DYNAMIC_NO_PIC = NO;
-                    GCC_NO_COMMON_BLOCKS = YES;
-                    GCC_OPTIMIZATION_LEVEL = 0;
-                    GCC_PREPROCESSOR_DEFINITIONS = (
-                        "DEBUG=1",
-                        "$(inherited)",
-                    );
-                    GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                    GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                    GCC_WARN_UNDECLARED_SELECTOR = YES;
-                    GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                    GCC_WARN_UNUSED_FUNCTION = YES;
-                    GCC_WARN_UNUSED_VARIABLE = YES;
-                    MACOSX_DEPLOYMENT_TARGET = 12.1;
-                    MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
-                    MTL_FAST_MATH = YES;
-                    ONLY_ACTIVE_ARCH = YES;
-                    SDKROOT = macosx;
-                };
-                name = Debug;
-            };
-            4102E01B27E0F83900A6AD9D /* Release */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 4102E03E27E1CEB000A6AD9D /* conan_config.xcconfig */;
-                buildSettings = {
-                    ALWAYS_SEARCH_USER_PATHS = NO;
-                    CLANG_ANALYZER_NONNULL = YES;
-                    CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                    CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
-                    CLANG_CXX_LIBRARY = "libc++";
-                    CLANG_ENABLE_MODULES = YES;
-                    CLANG_ENABLE_OBJC_ARC = YES;
-                    CLANG_ENABLE_OBJC_WEAK = YES;
-                    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                    CLANG_WARN_BOOL_CONVERSION = YES;
-                    CLANG_WARN_COMMA = YES;
-                    CLANG_WARN_CONSTANT_CONVERSION = YES;
-                    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                    CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                    CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                    CLANG_WARN_EMPTY_BODY = YES;
-                    CLANG_WARN_ENUM_CONVERSION = YES;
-                    CLANG_WARN_INFINITE_RECURSION = YES;
-                    CLANG_WARN_INT_CONVERSION = YES;
-                    CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                    CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                    CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                    CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                    CLANG_WARN_STRICT_PROTOTYPES = YES;
-                    CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                    CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                    CLANG_WARN_UNREACHABLE_CODE = YES;
-                    CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                    COPY_PHASE_STRIP = NO;
-                    DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
-                    DEPLOYMENT_LOCATION = NO;
-                    ENABLE_NS_ASSERTIONS = NO;
-                    ENABLE_STRICT_OBJC_MSGSEND = YES;
-                    GCC_C_LANGUAGE_STANDARD = gnu11;
-                    GCC_NO_COMMON_BLOCKS = YES;
-                    GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                    GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                    GCC_WARN_UNDECLARED_SELECTOR = YES;
-                    GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                    GCC_WARN_UNUSED_FUNCTION = YES;
-                    GCC_WARN_UNUSED_VARIABLE = YES;
-                    MACOSX_DEPLOYMENT_TARGET = 12.1;
-                    MTL_ENABLE_DEBUG_INFO = NO;
-                    MTL_FAST_MATH = YES;
-                    SDKROOT = macosx;
-                };
-                name = Release;
-            };
-            4102E01D27E0F83900A6AD9D /* Debug */ = {
-                isa = XCBuildConfiguration;
-                buildSettings = {
-                    CODE_SIGN_STYLE = Automatic;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    EXECUTABLE_EXTENSION = dylib;
-                    EXECUTABLE_PREFIX = lib;
-                    MACH_O_TYPE = mh_dylib;
-                    PRODUCT_NAME = hello;
-                    SKIP_INSTALL = YES;
-                };
-                name = Debug;
-            };
-            4102E01E27E0F83900A6AD9D /* Release */ = {
-                isa = XCBuildConfiguration;
-                buildSettings = {
-                    CODE_SIGN_STYLE = Automatic;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    EXECUTABLE_EXTENSION = dylib;
-                    EXECUTABLE_PREFIX = lib;
-                    MACH_O_TYPE = mh_dylib;
-                    PRODUCT_NAME = hello;
-                    SKIP_INSTALL = YES;
-                };
-                name = Release;
-            };
-            4102E03B27E1027F00A6AD9D /* Debug */ = {
-                isa = XCBuildConfiguration;
-                buildSettings = {
-                    CODE_SIGN_STYLE = Automatic;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    EXECUTABLE_EXTENSION = a;
-                    EXECUTABLE_PREFIX = lib;
-                    MACH_O_TYPE = staticlib;
-                    PRODUCT_NAME = hello;
-                    SKIP_INSTALL = YES;
-                };
-                name = Debug;
-            };
-            4102E03C27E1027F00A6AD9D /* Release */ = {
-                isa = XCBuildConfiguration;
-                buildSettings = {
-                    CODE_SIGN_STYLE = Automatic;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    EXECUTABLE_EXTENSION = a;
-                    EXECUTABLE_PREFIX = lib;
-                    MACH_O_TYPE = staticlib;
-                    PRODUCT_NAME = hello;
-                    SKIP_INSTALL = YES;
-                };
-                name = Release;
-            };
-    /* End XCBuildConfiguration section */
-
-    /* Begin XCConfigurationList section */
-            4102E01327E0F83900A6AD9D /* Build configuration list for PBXProject "HelloLibrary" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    4102E01A27E0F83900A6AD9D /* Debug */,
-                    4102E01B27E0F83900A6AD9D /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-            4102E01C27E0F83900A6AD9D /* Build configuration list for PBXNativeTarget "hello-dynamic" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    4102E01D27E0F83900A6AD9D /* Debug */,
-                    4102E01E27E0F83900A6AD9D /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-            4102E03A27E1027F00A6AD9D /* Build configuration list for PBXNativeTarget "hello-static" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    4102E03B27E1027F00A6AD9D /* Debug */,
-                    4102E03C27E1027F00A6AD9D /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-    /* End XCConfigurationList section */
-        };
-        rootObject = 4102E01027E0F83900A6AD9D /* Project object */;
-    }
+xcode_project = textwrap.dedent("""
+    name: HelloLibrary
+    targets:
+      hello-static:
+        type: library.static
+        platform: macOS
+        sources:
+          - src
+        configFiles:
+          Debug: static.xcconfig
+          Release: static.xcconfig
+      hello-dynamic:
+        type: library.dynamic
+        platform: macOS
+        sources:
+          - src
+        configFiles:
+          Debug: dynamic.xcconfig
+          Release: dynamic.xcconfig
+
     """)
 
 hello_cpp = textwrap.dedent("""
@@ -480,7 +117,7 @@ class HelloLib(ConanFile):
         version = "1.0"
         settings = "os", "compiler", "build_type", "arch"
         generators = "XcodeToolchain"
-        exports_sources = "HelloLibrary.xcodeproj/*", "src/*"
+        exports_sources = "HelloLibrary.xcodeproj/*", "src/*", "static.xcconfig", "dynamic.xcconfig"
         options = {"shared": [True, False], "fPIC": [True, False]}
         default_options = {"shared": False, "fPIC": True}
 
@@ -492,13 +129,25 @@ def build(self):
                 xcode.build("HelloLibrary.xcodeproj", target="hello-static")
 
         def package(self):
-            copy(self, "*/libhello*", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
+            name = "hello-dynamic.dylib" if self.options.shared else "libhello-static.a"
+            copy(self, "build/{}/{}".format(self.settings.build_type, name),
+                 src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False)
             copy(self, "*/*.hpp", src=self.build_folder, dst=os.path.join(self.package_folder, "include"), keep_path=False)
 
         def package_info(self):
-            self.cpp_info.libs = ["hello"]
+            self.cpp_info.libs = ["hello-{}".format("dynamic.dylib" if self.options.shared else "static")]
     """)
 
+static_xcconfig = textwrap.dedent("""
+    #include \"conan_config.xcconfig\"
+    LD_DYLIB_INSTALL_NAME = @rpath/libhello-static.dylib
+""")
+
+dynamic_xcconfig = textwrap.dedent("""
+    #include \"conan_config.xcconfig\"
+    LD_DYLIB_INSTALL_NAME = @rpath/hello-dynamic.dylib
+""")
+
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_xcodebuild
@@ -511,17 +160,23 @@ def test_shared_static_targets():
     client.save({"conanfile.py": conanfile,
                  "src/hello.cpp": hello_cpp,
                  "src/hello.hpp": hello_hpp,
-                 "HelloLibrary.xcodeproj/project.pbxproj": pbxproj,
+                 "project.yml": xcode_project,
                  "test_package/conanfile.py": test,
                  "test_package/src/example.cpp": test_src,
-                 "test_package/CMakeLists.txt": cmakelists})
+                 "test_package/CMakeLists.txt": cmakelists,
+                 "conan_config.xcconfig": "",
+                 "static.xcconfig": static_xcconfig,
+                 "dynamic.xcconfig": dynamic_xcconfig})
+
+    client.run_command("xcodegen generate")
+
     client.run("create . -o *:shared=True -tf None")
-    assert "Packaged 1 '.dylib' file: libhello.dylib" in client.out
+    assert "Packaged 1 '.dylib' file: hello-dynamic.dylib" in client.out
     client.run("test test_package hello/1.0@ -o *:shared=True")
-    assert "/build/Release/libhello.dylib" in client.out
+    assert "@rpath/hello-dynamic.dylib" in client.out
 
     client.run("create . -tf None")
-    assert "Packaged 1 '.a' file: libhello.a" in client.out
+    assert "Packaged 1 '.a' file: libhello-static.a" in client.out
     client.run("test test_package hello/1.0@")
     # check the symbol hellofunction in in the executable
     assert "hellofunction" in client.out
diff --git a/conans/test/functional/toolchains/apple/test_xcodedeps_build_configs.py b/conans/test/functional/toolchains/apple/test_xcodedeps_build_configs.py
index 2e514ebca2b..93f89b95d11 100644
--- a/conans/test/functional/toolchains/apple/test_xcodedeps_build_configs.py
+++ b/conans/test/functional/toolchains/apple/test_xcodedeps_build_configs.py
@@ -8,300 +8,24 @@
 from conans.test.utils.tools import TestClient
 
 
-def create_xcode_project(client, project_name, source):
-    pbxproj = textwrap.dedent("""
-        // !$*UTF8*$!
-        {{
-            archiveVersion = 1;
-            classes = {{
-            }};
-            objectVersion = 55;
-            objects = {{
-
-        /* Begin PBXBuildFile section */
-                07879B4027219EE500B6FB51 /* main.cpp in Sources */ = {{isa = PBXBuildFile; fileRef = 07879B3F27219EE500B6FB51 /* main.cpp */; }};
-        /* End PBXBuildFile section */
-
-        /* Begin PBXCopyFilesBuildPhase section */
-                07879B3A27219EE500B6FB51 /* CopyFiles */ = {{
-                    isa = PBXCopyFilesBuildPhase;
-                    buildActionMask = 2147483647;
-                    dstPath = /usr/share/man/man1/;
-                    dstSubfolderSpec = 0;
-                    files = (
-                    );
-                    runOnlyForDeploymentPostprocessing = 1;
-                }};
-        /* End PBXCopyFilesBuildPhase section */
-
-        /* Begin PBXFileReference section */
-                07879B3C27219EE500B6FB51 /* {project_name} */ = {{isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = {project_name}; sourceTree = BUILT_PRODUCTS_DIR; }};
-                07879B3F27219EE500B6FB51 /* main.cpp */ = {{isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; }};
-        /* End PBXFileReference section */
-
-        /* Begin PBXFrameworksBuildPhase section */
-                07879B3927219EE500B6FB51 /* Frameworks */ = {{
-                    isa = PBXFrameworksBuildPhase;
-                    buildActionMask = 2147483647;
-                    files = (
-                    );
-                    runOnlyForDeploymentPostprocessing = 0;
-                }};
-        /* End PBXFrameworksBuildPhase section */
-
-        /* Begin PBXGroup section */
-                07879B3327219EE500B6FB51 = {{
-                    isa = PBXGroup;
-                    children = (
-                        07879B3E27219EE500B6FB51 /* {project_name} */,
-                        07879B3D27219EE500B6FB51 /* Products */,
-                    );
-                    sourceTree = "<group>";
-                }};
-                07879B3D27219EE500B6FB51 /* Products */ = {{
-                    isa = PBXGroup;
-                    children = (
-                        07879B3C27219EE500B6FB51 /* {project_name} */,
-                    );
-                    name = Products;
-                    sourceTree = "<group>";
-                }};
-                07879B3E27219EE500B6FB51 /* {project_name} */ = {{
-                    isa = PBXGroup;
-                    children = (
-                        07879B3F27219EE500B6FB51 /* main.cpp */,
-                    );
-                    path = {project_name};
-                    sourceTree = "<group>";
-                }};
-        /* End PBXGroup section */
-
-        /* Begin PBXNativeTarget section */
-                07879B3B27219EE500B6FB51 /* {project_name} */ = {{
-                    isa = PBXNativeTarget;
-                    buildConfigurationList = 07879B4327219EE500B6FB51 /* Build configuration list for PBXNativeTarget "{project_name}" */;
-                    buildPhases = (
-                        07879B3827219EE500B6FB51 /* Sources */,
-                        07879B3927219EE500B6FB51 /* Frameworks */,
-                        07879B3A27219EE500B6FB51 /* CopyFiles */,
-                    );
-                    buildRules = (
-                    );
-                    dependencies = (
-                    );
-                    name = {project_name};
-                    productName = {project_name};
-                    productReference = 07879B3C27219EE500B6FB51 /* {project_name} */;
-                    productType = "com.apple.product-type.tool";
-                }};
-        /* End PBXNativeTarget section */
-
-        /* Begin PBXProject section */
-                07879B3427219EE500B6FB51 /* Project object */ = {{
-                    isa = PBXProject;
-                    attributes = {{
-                        BuildIndependentTargetsInParallel = 1;
-                        LastUpgradeCheck = 1300;
-                        TargetAttributes = {{
-                            07879B3B27219EE500B6FB51 = {{
-                                CreatedOnToolsVersion = 13.0;
-                            }};
-                        }};
-                    }};
-                    buildConfigurationList = 07879B3727219EE500B6FB51 /* Build configuration list for PBXProject "{project_name}" */;
-                    compatibilityVersion = "Xcode 13.0";
-                    developmentRegion = en;
-                    hasScannedForEncodings = 0;
-                    knownRegions = (
-                        en,
-                        Base,
-                    );
-                    mainGroup = 07879B3327219EE500B6FB51;
-                    productRefGroup = 07879B3D27219EE500B6FB51 /* Products */;
-                    projectDirPath = "";
-                    projectRoot = "";
-                    targets = (
-                        07879B3B27219EE500B6FB51 /* {project_name} */,
-                    );
-                }};
-        /* End PBXProject section */
-
-        /* Begin PBXSourcesBuildPhase section */
-                07879B3827219EE500B6FB51 /* Sources */ = {{
-                    isa = PBXSourcesBuildPhase;
-                    buildActionMask = 2147483647;
-                    files = (
-                        07879B4027219EE500B6FB51 /* main.cpp in Sources */,
-                    );
-                    runOnlyForDeploymentPostprocessing = 0;
-                }};
-        /* End PBXSourcesBuildPhase section */
-
-        /* Begin XCBuildConfiguration section */
-                07879B4127219EE500B6FB51 /* Debug */ = {{
-                    isa = XCBuildConfiguration;
-                    buildSettings = {{
-                        ALWAYS_SEARCH_USER_PATHS = NO;
-                        CLANG_ANALYZER_NONNULL = YES;
-                        CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                        CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
-                        CLANG_CXX_LIBRARY = "libc++";
-                        CLANG_ENABLE_MODULES = YES;
-                        CLANG_ENABLE_OBJC_ARC = YES;
-                        CLANG_ENABLE_OBJC_WEAK = YES;
-                        CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                        CLANG_WARN_BOOL_CONVERSION = YES;
-                        CLANG_WARN_COMMA = YES;
-                        CLANG_WARN_CONSTANT_CONVERSION = YES;
-                        CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                        CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                        CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                        CLANG_WARN_EMPTY_BODY = YES;
-                        CLANG_WARN_ENUM_CONVERSION = YES;
-                        CLANG_WARN_INFINITE_RECURSION = YES;
-                        CLANG_WARN_INT_CONVERSION = YES;
-                        CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                        CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                        CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                        CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                        CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                        CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                        CLANG_WARN_STRICT_PROTOTYPES = YES;
-                        CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                        CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                        CLANG_WARN_UNREACHABLE_CODE = YES;
-                        CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                        COPY_PHASE_STRIP = NO;
-                        DEBUG_INFORMATION_FORMAT = dwarf;
-                        ENABLE_STRICT_OBJC_MSGSEND = YES;
-                        ENABLE_TESTABILITY = YES;
-                        GCC_C_LANGUAGE_STANDARD = gnu11;
-                        GCC_DYNAMIC_NO_PIC = NO;
-                        GCC_NO_COMMON_BLOCKS = YES;
-                        GCC_OPTIMIZATION_LEVEL = 0;
-                        GCC_PREPROCESSOR_DEFINITIONS = (
-                            "DEBUG=1",
-                            "$(inherited)",
-                        );
-                        GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                        GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                        GCC_WARN_UNDECLARED_SELECTOR = YES;
-                        GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                        GCC_WARN_UNUSED_FUNCTION = YES;
-                        GCC_WARN_UNUSED_VARIABLE = YES;
-                        MACOSX_DEPLOYMENT_TARGET = 11.3;
-                        MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
-                        MTL_FAST_MATH = YES;
-                        ONLY_ACTIVE_ARCH = YES;
-                        SDKROOT = macosx;
-                    }};
-                    name = Debug;
-                }};
-                07879B4227219EE500B6FB51 /* Release */ = {{
-                    isa = XCBuildConfiguration;
-                    buildSettings = {{
-                        ALWAYS_SEARCH_USER_PATHS = NO;
-                        CLANG_ANALYZER_NONNULL = YES;
-                        CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                        CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
-                        CLANG_CXX_LIBRARY = "libc++";
-                        CLANG_ENABLE_MODULES = YES;
-                        CLANG_ENABLE_OBJC_ARC = YES;
-                        CLANG_ENABLE_OBJC_WEAK = YES;
-                        CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                        CLANG_WARN_BOOL_CONVERSION = YES;
-                        CLANG_WARN_COMMA = YES;
-                        CLANG_WARN_CONSTANT_CONVERSION = YES;
-                        CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                        CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                        CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                        CLANG_WARN_EMPTY_BODY = YES;
-                        CLANG_WARN_ENUM_CONVERSION = YES;
-                        CLANG_WARN_INFINITE_RECURSION = YES;
-                        CLANG_WARN_INT_CONVERSION = YES;
-                        CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                        CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                        CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                        CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                        CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                        CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                        CLANG_WARN_STRICT_PROTOTYPES = YES;
-                        CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                        CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                        CLANG_WARN_UNREACHABLE_CODE = YES;
-                        CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                        COPY_PHASE_STRIP = NO;
-                        DEBUG_INFORMATION_FORMAT = dwarf;
-                        ENABLE_NS_ASSERTIONS = NO;
-                        ENABLE_STRICT_OBJC_MSGSEND = YES;
-                        GCC_C_LANGUAGE_STANDARD = gnu11;
-                        GCC_NO_COMMON_BLOCKS = YES;
-                        GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                        GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                        GCC_WARN_UNDECLARED_SELECTOR = YES;
-                        GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                        GCC_WARN_UNUSED_FUNCTION = YES;
-                        GCC_WARN_UNUSED_VARIABLE = YES;
-                        MACOSX_DEPLOYMENT_TARGET = 11.3;
-                        MTL_ENABLE_DEBUG_INFO = NO;
-                        MTL_FAST_MATH = YES;
-                        SDKROOT = macosx;
-                    }};
-                    name = Release;
-                }};
-                07879B4427219EE500B6FB51 /* Debug */ = {{
-                    isa = XCBuildConfiguration;
-                    buildSettings = {{
-                        CODE_SIGN_STYLE = Automatic;
-                        PRODUCT_NAME = "$(TARGET_NAME)";
-                    }};
-                    name = Debug;
-                }};
-                07879B4527219EE500B6FB51 /* Release */ = {{
-                    isa = XCBuildConfiguration;
-                    buildSettings = {{
-                        CODE_SIGN_STYLE = Automatic;
-                        PRODUCT_NAME = "$(TARGET_NAME)";
-                    }};
-                    name = Release;
-                }};
-        /* End XCBuildConfiguration section */
-
-        /* Begin XCConfigurationList section */
-                07879B3727219EE500B6FB51 /* Build configuration list for PBXProject "{project_name}" */ = {{
-                    isa = XCConfigurationList;
-                    buildConfigurations = (
-                        07879B4127219EE500B6FB51 /* Debug */,
-                        07879B4227219EE500B6FB51 /* Release */,
-                    );
-                    defaultConfigurationIsVisible = 0;
-                    defaultConfigurationName = Release;
-                }};
-                07879B4327219EE500B6FB51 /* Build configuration list for PBXNativeTarget "{project_name}" */ = {{
-                    isa = XCConfigurationList;
-                    buildConfigurations = (
-                        07879B4427219EE500B6FB51 /* Debug */,
-                        07879B4527219EE500B6FB51 /* Release */,
-                    );
-                    defaultConfigurationIsVisible = 0;
-                    defaultConfigurationName = Release;
-                }};
-        /* End XCConfigurationList section */
-            }};
-            rootObject = 07879B3427219EE500B6FB51 /* Project object */;
-        }}
-        """)
-
-    client.save({
-        "{}.xcodeproj/project.pbxproj".format(project_name): pbxproj.format(
-            project_name=project_name),
-        "{}/main.cpp".format(project_name): source
-    })
+xcode_project = textwrap.dedent("""
+    name: app
+    targets:
+      app:
+        type: tool
+        platform: macOS
+        sources:
+          - main.cpp
+        configFiles:
+          Debug: conan_config.xcconfig
+          Release: conan_config.xcconfig
+    """)
 
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_cmake
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 def test_xcodedeps_build_configurations():
     client = TestClient(path_with_spaces=False)
 
@@ -326,18 +50,20 @@ def test_xcodedeps_build_configurations():
         }
         """)
 
-    project_name = "app"
-    client.save({"conanfile.txt": "[requires]\nhello/0.1\nbye/0.1\n"}, clean_first=True)
-    create_xcode_project(client, project_name, main)
+    client.save({
+        "conanfile.txt": "[requires]\nhello/0.1\nbye/0.1\n",
+        "main.cpp": main,
+        "project.yml": xcode_project,
+    }, clean_first=True)
 
     for config in ["Release", "Debug"]:
-        client.run(
-            "install . -s build_type={} -s arch=x86_64 --build=missing -g XcodeDeps".format(config))
+        client.run("install . -s build_type={} -s arch=x86_64 --build=missing -g XcodeDeps".format(config))
+
+    client.run_command("xcodegen generate")
 
     for config in ["Release", "Debug"]:
-        client.run_command("xcodebuild -project {}.xcodeproj -xcconfig conandeps.xcconfig "
-                           "-configuration {} -arch x86_64".format(project_name, config))
-        client.run_command("./build/{}/{}".format(config, project_name))
+        client.run_command("xcodebuild -project app.xcodeproj -configuration {} -arch x86_64".format(config))
+        client.run_command("./build/{}/app".format(config))
         assert "App {}!".format(config) in client.out
         assert "hello/0.1: Hello World {}!".format(config).format(config) in client.out
 
@@ -345,6 +71,7 @@ def test_xcodedeps_build_configurations():
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_cmake
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 def test_frameworks():
     client = TestClient(path_with_spaces=False)
 
@@ -362,35 +89,40 @@ def test_frameworks():
         """)
 
     project_name = "app"
-    client.save({"conanfile.txt": "[requires]\nhello/0.1\n"}, clean_first=True)
-    create_xcode_project(client, project_name, main)
+    client.save({"conanfile.txt": "[requires]\nhello/0.1\n",
+                 "main.cpp": main,
+                 "project.yml": xcode_project}, clean_first=True)
 
     client.run("install . -s build_type=Release -s arch=x86_64 --build=missing -g XcodeDeps")
-
-    client.run_command("xcodebuild -project {}.xcodeproj -xcconfig conandeps.xcconfig "
-                       "-configuration Release -arch x86_64".format(project_name))
+    client.run_command("xcodegen generate")
+    client.run_command("xcodebuild -project app.xcodeproj -configuration Release -arch x86_64")
     client.run_command("./build/Release/{}".format(project_name))
     assert "Hello!" in client.out
 
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 def test_xcodedeps_dashes_names_and_arch():
     # https://github.com/conan-io/conan/issues/9949
     client = TestClient(path_with_spaces=False)
     client.save({"conanfile.py": GenConanfile().with_name("hello-dashes").with_version("0.1")})
     client.run("export .")
-    client.save({"conanfile.txt": "[requires]\nhello-dashes/0.1\n"}, clean_first=True)
     main = "int main(int argc, char *argv[]) { return 0; }"
-    create_xcode_project(client, "app", main)
+    client.save({"conanfile.txt": "[requires]\nhello-dashes/0.1\n",
+                 "main.cpp": main,
+                 "project.yml": xcode_project}, clean_first=True)
     client.run("install . -s arch=armv8 --build=missing -g XcodeDeps")
     assert os.path.exists(os.path.join(client.current_folder,
-                                       "conan_hello_dashes_vars_release_arm64.xcconfig"))
-    client.run_command("xcodebuild -project app.xcodeproj -xcconfig conandeps.xcconfig -arch arm64")
+                                       "conan_hello_dashes_hello_dashes_vars_release_arm64.xcconfig"))
+    client.run_command("xcodegen generate")
+    client.run_command("xcodebuild -project app.xcodeproj -arch arm64")
+    assert "BUILD SUCCEEDED" in client.out
 
 
 @pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
 @pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
 def test_xcodedeps_definitions_escape():
     client = TestClient(path_with_spaces=False)
     conanfile = textwrap.dedent('''
@@ -403,7 +135,6 @@ def package_info(self):
         ''')
     client.save({"conanfile.py": conanfile})
     client.run("export . hello/1.0@")
-    client.save({"conanfile.txt": "[requires]\nhello/1.0\n"}, clean_first=True)
     main = textwrap.dedent("""
                                 #include <stdio.h>
                                 #define STR(x)   #x
@@ -414,9 +145,12 @@ def package_info(self):
                                     return 0;
                                 }
                                 """)
-    create_xcode_project(client, "app", main)
+    client.save({"conanfile.txt": "[requires]\nhello/1.0\n",
+                 "main.cpp": main,
+                 "project.yml": xcode_project}, clean_first=True)
     client.run("install . --build=missing -g XcodeDeps")
-    client.run_command("xcodebuild -project app.xcodeproj -xcconfig conandeps.xcconfig")
-    client.run_command("build/Release/app")
+    client.run_command("xcodegen generate")
+    client.run_command("xcodebuild -project app.xcodeproj -configuration Release")
+    client.run_command("./build/Release/app")
     assert 'USER_CONFIG="user_config.h"' in client.out
     assert 'OTHER="other.h"' in client.out
diff --git a/conans/test/functional/toolchains/apple/test_xcodedeps_components.py b/conans/test/functional/toolchains/apple/test_xcodedeps_components.py
new file mode 100644
index 00000000000..d97b6fe489b
--- /dev/null
+++ b/conans/test/functional/toolchains/apple/test_xcodedeps_components.py
@@ -0,0 +1,191 @@
+import os
+import platform
+import textwrap
+
+import pytest
+
+from conans.test.utils.tools import TestClient
+
+
+@pytest.mark.skipif(platform.system() != "Darwin", reason="Only for MacOS")
+@pytest.mark.tool_cmake
+@pytest.mark.tool_xcodebuild
+@pytest.mark.tool_xcodegen
+def test_xcodedeps_components():
+    client = TestClient(path_with_spaces=False)
+
+    client.run("new tcp/1.0 -m=cmake_lib")
+    client.run("create . -tf=None")
+
+    header = textwrap.dedent("""
+        #pragma once
+        void {name}();
+        """)
+
+    source = textwrap.dedent("""
+        #include <iostream>
+        #include "{name}.h"
+        {include}
+
+        void {name}(){{
+            {call}
+            #ifdef NDEBUG
+            std::cout << "{name}/1.0: Hello World Release!" << std::endl;
+            #else
+            std::cout << "{name}/1.0: Hello World Debug!" << std::endl;
+            #endif
+        }}
+        """)
+
+    cmakelists = textwrap.dedent("""
+        cmake_minimum_required(VERSION 3.15)
+        project(myproject CXX)
+
+        find_package(tcp REQUIRED CONFIG)
+
+        add_library(core src/core.cpp include/core.h)
+        add_library(client src/client.cpp include/client.h)
+        add_library(server src/server.cpp include/server.h)
+
+        target_include_directories(core PUBLIC include)
+        target_include_directories(client PUBLIC include)
+        target_include_directories(server PUBLIC include)
+
+        set_target_properties(core PROPERTIES PUBLIC_HEADER "include/core.h")
+        set_target_properties(client PROPERTIES PUBLIC_HEADER "include/client.h")
+        set_target_properties(server PROPERTIES PUBLIC_HEADER "include/server.h")
+
+        target_link_libraries(client core tcp::tcp)
+        target_link_libraries(server core tcp::tcp)
+
+        install(TARGETS core client server)
+        """)
+
+    conanfile_py = textwrap.dedent("""
+        import os
+
+        from conan import ConanFile
+        from conan.tools.cmake import CMake, cmake_layout
+
+
+        class LibConan(ConanFile):
+            settings = "os", "compiler", "build_type", "arch"
+            exports_sources = "CMakeLists.txt", "src/*", "include/*"
+            {requires}
+            generators = "CMakeToolchain", "CMakeDeps"
+
+            def layout(self):
+                cmake_layout(self)
+
+            def build(self):
+                cmake = CMake(self)
+                cmake.configure()
+                cmake.build()
+
+            def package(self):
+                cmake = CMake(self)
+                cmake.install()
+            {package_info}
+        """)
+
+    network_pi = """
+    def package_info(self):
+        self.cpp_info.components["core"].libs = ["core"]
+        self.cpp_info.components["core"].includedirs.append("include")
+        self.cpp_info.components["core"].libdirs.append("lib")
+
+        self.cpp_info.components["client"].libs = ["client"]
+        self.cpp_info.components["client"].includedirs.append("include")
+        self.cpp_info.components["client"].libdirs.append("lib")
+        self.cpp_info.components["client"].requires.extend(["core", "tcp::tcp"])
+
+        self.cpp_info.components["server"].libs = ["server"]
+        self.cpp_info.components["server"].includedirs.append("include")
+        self.cpp_info.components["server"].libdirs.append("lib")
+        self.cpp_info.components["server"].requires.extend(["core", "tcp::tcp"])
+    """
+
+    client.save({
+        "include/core.h": header.format(name="core"),
+        "include/server.h": header.format(name="server"),
+        "include/client.h": header.format(name="client"),
+        "src/core.cpp": source.format(name="core", include="", call=""),
+        "src/server.cpp": source.format(name="server", include='#include "core.h"\n#include "tcp.h"',
+                                        call="core(); tcp();"),
+        "src/client.cpp": source.format(name="client", include='#include "core.h"\n#include "tcp.h"',
+                                        call="core(); tcp();"),
+        "conanfile.py": conanfile_py.format(requires='requires= "tcp/1.0"', package_info=network_pi),
+        "CMakeLists.txt": cmakelists,
+    }, clean_first=True)
+
+    client.run("create . network/1.0@")
+
+    chat_pi = """
+    def package_info(self):
+        self.cpp_info.libs = ["chat"]
+        self.cpp_info.includedirs.append("include")
+        self.cpp_info.libdirs.append("lib")
+        self.cpp_info.requires.append("network::client")
+    """
+
+    cmakelists_chat = textwrap.dedent("""
+        cmake_minimum_required(VERSION 3.15)
+        project(chat CXX)
+        find_package(network REQUIRED CONFIG)
+        add_library(chat src/chat.cpp include/chat.h)
+        target_include_directories(chat PUBLIC include)
+        set_target_properties(chat PROPERTIES PUBLIC_HEADER "include/chat.h")
+        target_link_libraries(chat network::client)
+        install(TARGETS chat)
+        """)
+
+    client.save({
+        "include/chat.h": header.format(name="chat"),
+        "src/chat.cpp": source.format(name="chat", include='#include "client.h"', call="client();"),
+        "conanfile.py": conanfile_py.format(requires='requires= "network/1.0"',
+                                            package_info=chat_pi),
+        "CMakeLists.txt": cmakelists_chat,
+    }, clean_first=True)
+
+    client.run("create . chat/1.0@")
+
+    xcode_project = textwrap.dedent("""
+        name: ChatApp
+        fileGroups:
+          - conan
+        targets:
+          chat:
+            type: tool
+            platform: macOS
+            sources:
+              - src
+            configFiles:
+              Debug: conan/conan_config.xcconfig
+              Release: conan/conan_config.xcconfig
+        """)
+
+    client.save({
+        "src/main.cpp": '#include "chat.h"\nint main(){chat();return 0;}',
+        "project.yml": xcode_project
+    }, clean_first=True)
+
+    client.run("install chat/1.0@ -g XcodeDeps --install-folder=conan")
+    client.run("install chat/1.0@ -g XcodeDeps --install-folder=conan -s build_type=Debug "
+               "--build=missing")
+    chat_xcconfig = client.load(os.path.join("conan", "conan_chat_chat.xcconfig"))
+    assert '#include "conan_network_client.xcconfig"' in chat_xcconfig
+    assert '#include "conan_network_server.xcconfig"' not in chat_xcconfig
+    assert '#include "conan_network_network.xcconfig"' not in chat_xcconfig
+    client.run_command("xcodegen generate")
+    client.run_command("xcodebuild -project ChatApp.xcodeproj -configuration Release -arch x86_64")
+    client.run_command("xcodebuild -project ChatApp.xcodeproj -configuration Debug -arch x86_64")
+    client.run_command("build/Debug/chat")
+    assert "core/1.0: Hello World Debug!" in client.out
+    assert "tcp/1.0: Hello World Debug!" in client.out
+    assert "client/1.0: Hello World Debug!" in client.out
+    assert "chat/1.0: Hello World Debug!" in client.out
+    client.run_command("build/Release/chat")
+    assert "core/1.0: Hello World Release!" in client.out
+    assert "tcp/1.0: Hello World Release!" in client.out
+    assert "client/1.0: Hello World Release!" in client.out
+    assert "chat/1.0: Hello World Release!" in client.out
diff --git a/conans/test/functional/toolchains/apple/test_xcodetoolchain.py b/conans/test/functional/toolchains/apple/test_xcodetoolchain.py
index bf68e54ab79..7590f5adc78 100644
--- a/conans/test/functional/toolchains/apple/test_xcodetoolchain.py
+++ b/conans/test/functional/toolchains/apple/test_xcodetoolchain.py
@@ -6,319 +6,6 @@
 from conans.test.assets.sources import gen_function_cpp
 from conans.test.utils.tools import TestClient
 
-pbxproj = textwrap.dedent("""
-    // !$*UTF8*$!
-    {
-        archiveVersion = 1;
-        classes = {
-        };
-        objectVersion = 55;
-        objects = {
-
-    /* Begin PBXBuildFile section */
-            07879B4027219EE500B6FB51 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 07879B3F27219EE500B6FB51 /* main.cpp */; };
-    /* End PBXBuildFile section */
-
-    /* Begin PBXCopyFilesBuildPhase section */
-            07879B3A27219EE500B6FB51 /* CopyFiles */ = {
-                isa = PBXCopyFilesBuildPhase;
-                buildActionMask = 2147483647;
-                dstPath = /usr/share/man/man1/;
-                dstSubfolderSpec = 0;
-                files = (
-                );
-                runOnlyForDeploymentPostprocessing = 1;
-            };
-    /* End PBXCopyFilesBuildPhase section */
-
-    /* Begin PBXFileReference section */
-            07879B3C27219EE500B6FB51 /* app */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = app; sourceTree = BUILT_PRODUCTS_DIR; };
-            07879B3F27219EE500B6FB51 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
-            4130DB5F27BE8D0300BDEE84 /* conan_hello_release_x86_64_macosx_12_1.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_hello_release_x86_64_macosx_12_1.xcconfig; sourceTree = "<group>"; };
-            4130DB6027BE8D0300BDEE84 /* conan_hello_vars_debug_x86_64_macosx_12_1.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_hello_vars_debug_x86_64_macosx_12_1.xcconfig; sourceTree = "<group>"; };
-            4130DB6127BE8D0300BDEE84 /* conantoolchain_debug_x86_64_macosx_12_1.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conantoolchain_debug_x86_64_macosx_12_1.xcconfig; sourceTree = "<group>"; };
-            4130DB6227BE8D0300BDEE84 /* conantoolchain_release_x86_64_macosx_12_1.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conantoolchain_release_x86_64_macosx_12_1.xcconfig; sourceTree = "<group>"; };
-            4130DB6327BE8D0300BDEE84 /* conan_hello.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_hello.xcconfig; sourceTree = "<group>"; };
-            4130DB6427BE8D0300BDEE84 /* conan_hello_vars_release_x86_64_macosx_12_1.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_hello_vars_release_x86_64_macosx_12_1.xcconfig; sourceTree = "<group>"; };
-            4130DB6527BE8D0300BDEE84 /* conan_hello_debug_x86_64_macosx_12_1.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_hello_debug_x86_64_macosx_12_1.xcconfig; sourceTree = "<group>"; };
-            4130DB6627BE8D0300BDEE84 /* conan_config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conan_config.xcconfig; sourceTree = "<group>"; };
-            4130DB6727BE8D0300BDEE84 /* conantoolchain.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conantoolchain.xcconfig; sourceTree = "<group>"; };
-            4130DB6827BE8D0300BDEE84 /* conandeps.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = conandeps.xcconfig; sourceTree = "<group>"; };
-            416ED66527F1FFAE00664526 /* conan_global_flags.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = conan_global_flags.xcconfig; sourceTree = "<group>"; };
-    /* End PBXFileReference section */
-
-    /* Begin PBXFrameworksBuildPhase section */
-            07879B3927219EE500B6FB51 /* Frameworks */ = {
-                isa = PBXFrameworksBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXFrameworksBuildPhase section */
-
-    /* Begin PBXGroup section */
-            07879B3327219EE500B6FB51 = {
-                isa = PBXGroup;
-                children = (
-                    4130DB6927BE8D0D00BDEE84 /* conan */,
-                    07879B3E27219EE500B6FB51 /* app */,
-                    07879B3D27219EE500B6FB51 /* Products */,
-                );
-                sourceTree = "<group>";
-            };
-            07879B3D27219EE500B6FB51 /* Products */ = {
-                isa = PBXGroup;
-                children = (
-                    07879B3C27219EE500B6FB51 /* app */,
-                );
-                name = Products;
-                sourceTree = "<group>";
-            };
-            07879B3E27219EE500B6FB51 /* app */ = {
-                isa = PBXGroup;
-                children = (
-                    07879B3F27219EE500B6FB51 /* main.cpp */,
-                );
-                path = app;
-                sourceTree = "<group>";
-            };
-            4130DB6927BE8D0D00BDEE84 /* conan */ = {
-                isa = PBXGroup;
-                children = (
-                    416ED66527F1FFAE00664526 /* conan_global_flags.xcconfig */,
-                    4130DB6627BE8D0300BDEE84 /* conan_config.xcconfig */,
-                    4130DB6527BE8D0300BDEE84 /* conan_hello_debug_x86_64_macosx_12_1.xcconfig */,
-                    4130DB5F27BE8D0300BDEE84 /* conan_hello_release_x86_64_macosx_12_1.xcconfig */,
-                    4130DB6027BE8D0300BDEE84 /* conan_hello_vars_debug_x86_64_macosx_12_1.xcconfig */,
-                    4130DB6427BE8D0300BDEE84 /* conan_hello_vars_release_x86_64_macosx_12_1.xcconfig */,
-                    4130DB6327BE8D0300BDEE84 /* conan_hello.xcconfig */,
-                    4130DB6827BE8D0300BDEE84 /* conandeps.xcconfig */,
-                    4130DB6127BE8D0300BDEE84 /* conantoolchain_debug_x86_64_macosx_12_1.xcconfig */,
-                    4130DB6227BE8D0300BDEE84 /* conantoolchain_release_x86_64_macosx_12_1.xcconfig */,
-                    4130DB6727BE8D0300BDEE84 /* conantoolchain.xcconfig */,
-                );
-                name = conan;
-                sourceTree = "<group>";
-            };
-    /* End PBXGroup section */
-
-    /* Begin PBXNativeTarget section */
-            07879B3B27219EE500B6FB51 /* app */ = {
-                isa = PBXNativeTarget;
-                buildConfigurationList = 07879B4327219EE500B6FB51 /* Build configuration list for PBXNativeTarget "app" */;
-                buildPhases = (
-                    07879B3827219EE500B6FB51 /* Sources */,
-                    07879B3927219EE500B6FB51 /* Frameworks */,
-                    07879B3A27219EE500B6FB51 /* CopyFiles */,
-                );
-                buildRules = (
-                );
-                dependencies = (
-                );
-                name = app;
-                productName = app;
-                productReference = 07879B3C27219EE500B6FB51 /* app */;
-                productType = "com.apple.product-type.tool";
-            };
-    /* End PBXNativeTarget section */
-
-    /* Begin PBXProject section */
-            07879B3427219EE500B6FB51 /* Project object */ = {
-                isa = PBXProject;
-                attributes = {
-                    BuildIndependentTargetsInParallel = 1;
-                    LastUpgradeCheck = 1320;
-                    TargetAttributes = {
-                        07879B3B27219EE500B6FB51 = {
-                            CreatedOnToolsVersion = 13.0;
-                        };
-                    };
-                };
-                buildConfigurationList = 07879B3727219EE500B6FB51 /* Build configuration list for PBXProject "app" */;
-                compatibilityVersion = "Xcode 13.0";
-                developmentRegion = en;
-                hasScannedForEncodings = 0;
-                knownRegions = (
-                    en,
-                    Base,
-                );
-                mainGroup = 07879B3327219EE500B6FB51;
-                productRefGroup = 07879B3D27219EE500B6FB51 /* Products */;
-                projectDirPath = "";
-                projectRoot = "";
-                targets = (
-                    07879B3B27219EE500B6FB51 /* app */,
-                );
-            };
-    /* End PBXProject section */
-
-    /* Begin PBXSourcesBuildPhase section */
-            07879B3827219EE500B6FB51 /* Sources */ = {
-                isa = PBXSourcesBuildPhase;
-                buildActionMask = 2147483647;
-                files = (
-                    07879B4027219EE500B6FB51 /* main.cpp in Sources */,
-                );
-                runOnlyForDeploymentPostprocessing = 0;
-            };
-    /* End PBXSourcesBuildPhase section */
-
-    /* Begin XCBuildConfiguration section */
-            07879B4127219EE500B6FB51 /* Debug */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 4130DB6627BE8D0300BDEE84 /* conan_config.xcconfig */;
-                buildSettings = {
-                    ALWAYS_SEARCH_USER_PATHS = NO;
-                    ARCHS = x86_64;
-                    CLANG_ANALYZER_NONNULL = YES;
-                    CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                    CLANG_ENABLE_MODULES = YES;
-                    CLANG_ENABLE_OBJC_ARC = YES;
-                    CLANG_ENABLE_OBJC_WEAK = YES;
-                    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                    CLANG_WARN_BOOL_CONVERSION = YES;
-                    CLANG_WARN_COMMA = YES;
-                    CLANG_WARN_CONSTANT_CONVERSION = YES;
-                    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                    CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                    CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                    CLANG_WARN_EMPTY_BODY = YES;
-                    CLANG_WARN_ENUM_CONVERSION = YES;
-                    CLANG_WARN_INFINITE_RECURSION = YES;
-                    CLANG_WARN_INT_CONVERSION = YES;
-                    CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                    CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                    CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                    CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                    CLANG_WARN_STRICT_PROTOTYPES = YES;
-                    CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                    CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                    CLANG_WARN_UNREACHABLE_CODE = YES;
-                    CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                    COPY_PHASE_STRIP = NO;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    ENABLE_STRICT_OBJC_MSGSEND = YES;
-                    ENABLE_TESTABILITY = YES;
-                    GCC_C_LANGUAGE_STANDARD = gnu11;
-                    GCC_DYNAMIC_NO_PIC = NO;
-                    GCC_NO_COMMON_BLOCKS = YES;
-                    GCC_OPTIMIZATION_LEVEL = 0;
-                    GCC_PREPROCESSOR_DEFINITIONS = (
-                        "DEBUG=1",
-                        "$(inherited)",
-                    );
-                    GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                    GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                    GCC_WARN_UNDECLARED_SELECTOR = YES;
-                    GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                    GCC_WARN_UNUSED_FUNCTION = YES;
-                    GCC_WARN_UNUSED_VARIABLE = YES;
-                    MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
-                    MTL_FAST_MATH = YES;
-                    ONLY_ACTIVE_ARCH = YES;
-                    SDKROOT = macosx12.1;
-                };
-                name = Debug;
-            };
-            07879B4227219EE500B6FB51 /* Release */ = {
-                isa = XCBuildConfiguration;
-                baseConfigurationReference = 4130DB6627BE8D0300BDEE84 /* conan_config.xcconfig */;
-                buildSettings = {
-                    ALWAYS_SEARCH_USER_PATHS = NO;
-                    ARCHS = x86_64;
-                    CLANG_ANALYZER_NONNULL = YES;
-                    CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
-                    CLANG_ENABLE_MODULES = YES;
-                    CLANG_ENABLE_OBJC_ARC = YES;
-                    CLANG_ENABLE_OBJC_WEAK = YES;
-                    CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
-                    CLANG_WARN_BOOL_CONVERSION = YES;
-                    CLANG_WARN_COMMA = YES;
-                    CLANG_WARN_CONSTANT_CONVERSION = YES;
-                    CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
-                    CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
-                    CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
-                    CLANG_WARN_EMPTY_BODY = YES;
-                    CLANG_WARN_ENUM_CONVERSION = YES;
-                    CLANG_WARN_INFINITE_RECURSION = YES;
-                    CLANG_WARN_INT_CONVERSION = YES;
-                    CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
-                    CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
-                    CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
-                    CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
-                    CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
-                    CLANG_WARN_STRICT_PROTOTYPES = YES;
-                    CLANG_WARN_SUSPICIOUS_MOVE = YES;
-                    CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
-                    CLANG_WARN_UNREACHABLE_CODE = YES;
-                    CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
-                    COPY_PHASE_STRIP = NO;
-                    DEBUG_INFORMATION_FORMAT = dwarf;
-                    ENABLE_NS_ASSERTIONS = NO;
-                    ENABLE_STRICT_OBJC_MSGSEND = YES;
-                    GCC_C_LANGUAGE_STANDARD = gnu11;
-                    GCC_NO_COMMON_BLOCKS = YES;
-                    GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
-                    GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
-                    GCC_WARN_UNDECLARED_SELECTOR = YES;
-                    GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
-                    GCC_WARN_UNUSED_FUNCTION = YES;
-                    GCC_WARN_UNUSED_VARIABLE = YES;
-                    MTL_ENABLE_DEBUG_INFO = NO;
-                    MTL_FAST_MATH = YES;
-                    ONLY_ACTIVE_ARCH = YES;
-                    SDKROOT = macosx12.1;
-                };
-                name = Release;
-            };
-            07879B4427219EE500B6FB51 /* Debug */ = {
-                isa = XCBuildConfiguration;
-                buildSettings = {
-                    CODE_SIGN_IDENTITY = "-";
-                    CODE_SIGN_STYLE = Automatic;
-                    PRODUCT_NAME = "$(TARGET_NAME)";
-                };
-                name = Debug;
-            };
-            07879B4527219EE500B6FB51 /* Release */ = {
-                isa = XCBuildConfiguration;
-                buildSettings = {
-                    CODE_SIGN_IDENTITY = "-";
-                    CODE_SIGN_STYLE = Automatic;
-                    PRODUCT_NAME = "$(TARGET_NAME)";
-                };
-                name = Release;
-            };
-    /* End XCBuildConfiguration section */
-
-    /* Begin XCConfigurationList section */
-            07879B3727219EE500B6FB51 /* Build configuration list for PBXProject "app" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    07879B4127219EE500B6FB51 /* Debug */,
-                    07879B4227219EE500B6FB51 /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-            07879B4327219EE500B6FB51 /* Build configuration list for PBXNativeTarget "app" */ = {
-                isa = XCConfigurationList;
-                buildConfigurations = (
-                    07879B4427219EE500B6FB51 /* Debug */,
-                    07879B4527219EE500B6FB51 /* Release */,
-                );
-                defaultConfigurationIsVisible = 0;
-                defaultConfigurationName = Release;
-            };
-    /* End XCConfigurationList section */
-        };
-        rootObject = 07879B3427219EE500B6FB51 /* Project object */;
-    }
-    """)
 
 test = textwrap.dedent("""
     import os
@@ -346,7 +33,9 @@ def test_project_xcodetoolchain(cppstd, cppstd_output, min_version):
     client.run("export .")
 
     conanfile = textwrap.dedent("""
-        from conans import ConanFile
+        import os
+        from conan import ConanFile
+        from conan.tools.files import copy
         from conan.tools.apple import XcodeBuild
         class MyApplicationConan(ConanFile):
             name = "myapplication"
@@ -361,16 +50,33 @@ def build(self):
                 self.run("otool -l build/{}/app".format(self.settings.build_type))
 
             def package(self):
-                self.copy("*/app", dst="bin", src=".", keep_path=False)
+                copy(self, "build/{}/app".format(self.settings.build_type), self.build_folder,
+                     os.path.join(self.package_folder, "bin"), keep_path=False)
 
             def package_info(self):
                 self.cpp_info.bindirs = ["bin"]
         """)
 
+    xcode_project = textwrap.dedent("""
+        name: app
+        targets:
+          app:
+            type: tool
+            platform: macOS
+            sources:
+              - app
+            configFiles:
+              Debug: conan_config.xcconfig
+              Release: conan_config.xcconfig
+        """)
+
     client.save({"conanfile.py": conanfile,
                  "test_package/conanfile.py": test,
                  "app/main.cpp": gen_function_cpp(name="main", includes=["hello"], calls=["hello"]),
-                 "app.xcodeproj/project.pbxproj": pbxproj}, clean_first=True)
+                 "project.yml": xcode_project,
+                 "conan_config.xcconfig": ""}, clean_first=True)
+
+    client.run_command("xcodegen generate")
 
     sdk_version = "11.3"
     settings = "-s arch=x86_64 -s os.sdk=macosx -s os.sdk_version={} -s compiler.cppstd={} " \
diff --git a/conans/test/integration/toolchains/apple/test_xcodedeps.py b/conans/test/integration/toolchains/apple/test_xcodedeps.py
index dfa51264871..a1ca3d6d7b4 100644
--- a/conans/test/integration/toolchains/apple/test_xcodedeps.py
+++ b/conans/test/integration/toolchains/apple/test_xcodedeps.py
@@ -8,39 +8,39 @@
 from conans.test.utils.tools import TestClient
 
 _expected_dep_xconfig = [
-    "HEADER_SEARCH_PATHS = $(inherited) $(HEADER_SEARCH_PATHS_{name})",
-    "GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(GCC_PREPROCESSOR_DEFINITIONS_{name})",
-    "OTHER_CFLAGS = $(inherited) $(OTHER_CFLAGS_{name})",
-    "OTHER_CPLUSPLUSFLAGS = $(inherited) $(OTHER_CPLUSPLUSFLAGS_{name})",
-    "FRAMEWORK_SEARCH_PATHS = $(inherited) $(FRAMEWORK_SEARCH_PATHS_{name})",
-    "LIBRARY_SEARCH_PATHS = $(inherited) $(LIBRARY_SEARCH_PATHS_{name})",
-    "OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_{name})",
+    "HEADER_SEARCH_PATHS = $(inherited) $(HEADER_SEARCH_PATHS_{name}_{name})",
+    "GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(GCC_PREPROCESSOR_DEFINITIONS_{name}_{name})",
+    "OTHER_CFLAGS = $(inherited) $(OTHER_CFLAGS_{name}_{name})",
+    "OTHER_CPLUSPLUSFLAGS = $(inherited) $(OTHER_CPLUSPLUSFLAGS_{name}_{name})",
+    "FRAMEWORK_SEARCH_PATHS = $(inherited) $(FRAMEWORK_SEARCH_PATHS_{name}_{name})",
+    "LIBRARY_SEARCH_PATHS = $(inherited) $(LIBRARY_SEARCH_PATHS_{name}_{name})",
+    "OTHER_LDFLAGS = $(inherited) $(OTHER_LDFLAGS_{name}_{name})",
 ]
 
 _expected_vars_xconfig = [
-    "CONAN_{name}_BINARY_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_C_COMPILER_FLAGS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_CXX_COMPILER_FLAGS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_LINKER_FLAGS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_PREPROCESSOR_DEFINITIONS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_INCLUDE_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_RESOURCE_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_LIBRARY_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_LIBRARIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] = -l{name}",
-    "CONAN_{name}_SYSTEM_LIBS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_FRAMEWORKS_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
-    "CONAN_{name}_FRAMEWORKS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] = -framework framework_{name}"
+    "CONAN_{name}_{name}_BINARY_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_C_COMPILER_FLAGS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_CXX_COMPILER_FLAGS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_LINKER_FLAGS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_PREPROCESSOR_DEFINITIONS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_INCLUDE_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_RESOURCE_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_LIBRARY_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_LIBRARIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] = -l{name}",
+    "CONAN_{name}_{name}_SYSTEM_LIBS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_FRAMEWORKS_DIRECTORIES[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] =",
+    "CONAN_{name}_{name}_FRAMEWORKS[config={configuration}][arch={architecture}][sdk={sdk}{sdk_version}] = -framework framework_{name}"
 ]
 
 _expected_conf_xconfig = [
     "#include \"{vars_name}\"",
-    "HEADER_SEARCH_PATHS_{name} = $(CONAN_{name}_INCLUDE_DIRECTORIES",
-    "GCC_PREPROCESSOR_DEFINITIONS_{name} = $(CONAN_{name}_PREPROCESSOR_DEFINITIONS",
-    "OTHER_CFLAGS_{name} = $(CONAN_{name}_C_COMPILER_FLAGS",
-    "OTHER_CPLUSPLUSFLAGS_{name} = $(CONAN_{name}_CXX_COMPILER_FLAGS",
-    "FRAMEWORK_SEARCH_PATHS_{name} = $(CONAN_{name}_FRAMEWORKS_DIRECTORIES",
-    "LIBRARY_SEARCH_PATHS_{name} = $(CONAN_{name}_LIBRARY_DIRECTORIES",
-    "OTHER_LDFLAGS_{name} = $(CONAN_{name}_LINKER_FLAGS) $(CONAN_{name}_LIBRARIES) $(CONAN_{name}_SYSTEM_LIBS) $(CONAN_{name}_FRAMEWORKS"
+    "HEADER_SEARCH_PATHS_{name}_{name} = $(CONAN_{name}_{name}_INCLUDE_DIRECTORIES",
+    "GCC_PREPROCESSOR_DEFINITIONS_{name}_{name} = $(CONAN_{name}_{name}_PREPROCESSOR_DEFINITIONS",
+    "OTHER_CFLAGS_{name}_{name} = $(CONAN_{name}_{name}_C_COMPILER_FLAGS",
+    "OTHER_CPLUSPLUSFLAGS_{name}_{name} = $(CONAN_{name}_{name}_CXX_COMPILER_FLAGS",
+    "FRAMEWORK_SEARCH_PATHS_{name}_{name} = $(CONAN_{name}_{name}_FRAMEWORKS_DIRECTORIES",
+    "LIBRARY_SEARCH_PATHS_{name}_{name} = $(CONAN_{name}_{name}_LIBRARY_DIRECTORIES",
+    "OTHER_LDFLAGS_{name}_{name} = $(CONAN_{name}_{name}_LINKER_FLAGS) $(CONAN_{name}_{name}_LIBRARIES) $(CONAN_{name}_{name}_SYSTEM_LIBS) $(CONAN_{name}_{name}_FRAMEWORKS"
 ]
 
 
@@ -49,17 +49,17 @@ def expected_files(current_folder, configuration, architecture, sdk, sdk_version
     name = _get_filename(configuration, architecture, sdk, sdk_version)
     deps = ["hello", "goodbye"]
     files.extend(
-        [os.path.join(current_folder, "conan_{}{}.xcconfig".format(dep, name)) for dep in deps])
+        [os.path.join(current_folder, "conan_{dep}_{dep}{name}.xcconfig".format(dep=dep, name=name)) for dep in deps])
     files.extend(
-        [os.path.join(current_folder, "conan_{}_vars{}.xcconfig".format(dep, name)) for dep in deps])
+        [os.path.join(current_folder, "conan_{dep}_{dep}_vars{name}.xcconfig".format(dep=dep, name=name)) for dep in deps])
     files.append(os.path.join(current_folder, "conandeps.xcconfig"))
     return files
 
 
 def check_contents(client, deps, configuration, architecture, sdk, sdk_version):
     for dep_name in deps:
-        dep_xconfig = client.load("conan_{}.xcconfig".format(dep_name))
-        conf_name = "conan_{}{}.xcconfig".format(dep_name,
+        dep_xconfig = client.load("conan_{dep}_{dep}.xcconfig".format(dep=dep_name))
+        conf_name = "conan_{}_{}{}.xcconfig".format(dep_name, dep_name,
                                                  _get_filename(configuration, architecture, sdk, sdk_version))
 
         assert '#include "{}"'.format(conf_name) in dep_xconfig
@@ -67,7 +67,7 @@ def check_contents(client, deps, configuration, architecture, sdk, sdk_version):
             line = var.format(name=dep_name)
             assert line in dep_xconfig
 
-        vars_name = "conan_{}_vars{}.xcconfig".format(dep_name,
+        vars_name = "conan_{}_{}_vars{}.xcconfig".format(dep_name, dep_name,
                                                       _get_filename(configuration, architecture, sdk, sdk_version))
         conan_vars = client.load(vars_name)
         for var in _expected_vars_xconfig:
@@ -103,6 +103,7 @@ def test_generator_files():
             assert os.path.isfile(config_file)
 
         conandeps = client.load("conandeps.xcconfig")
+        print("jajsjdasdasda")
         assert '#include "conan_hello.xcconfig"' in conandeps
         assert '#include "conan_goodbye.xcconfig"' in conandeps
 


Code review comments:
diff_hunk: @@ -103,6 +103,7 @@ def test_generator_files():
             assert os.path.isfile(config_file)
 
         conandeps = client.load("conandeps.xcconfig")
+        print("jajsjdasdasda")
path: conans/test/integration/toolchains/apple/test_xcodedeps.py
text: @user1:
```suggestion
```