You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -69,7 +70,7 @@ You can also use environment variables in your configuration file, by using `${S
69
70
-[ ]**targets**: **[String: [Target](#target)]** - The list of targets in the project mapped by name
70
71
-[ ]**fileGroups**: **[String]** - A list of paths to add to the root of the project. These aren't files that will be included in your targets, but that you'd like to include in the project hierarchy anyway. For example a folder of xcconfig files that aren't already added by any target sources, or a Readme file.
71
72
-[ ]**schemes**: **[Scheme](#scheme)** - A list of schemes by name. This allows more control over what is found in [Target Scheme](#target-scheme)
72
-
-[ ]**schemeTemplates**: **[String: [Scheme Template](#scheme-template)]** - a list of schemes that can be used as templates for actual schems which reference them via a `template` property. They can be used to extract common scheme settings. Works great in combination with `include`.
73
+
-[ ]**schemeTemplates**: **[String: [Scheme Template](#scheme-template)]** - a list of schemes that can be used as templates for actual schemes which reference them via a `template` property. They can be used to extract common scheme settings. Works great in combination with `include`.
73
74
-[ ]**targetTemplates**: **[String: [Target Template](#target-template)]** - a list of targets that can be used as templates for actual targets which reference them via a `template` property. They can be used to extract common target settings. Works great in combination with `include`.
74
75
-[ ]**packages**: **[String: [Swift Package](#swift-package)]** - a map of Swift packages by name.
75
76
-[ ]**projectReferences**: **[String: [Project Reference](#project-reference)]** - a map of project references by name
@@ -357,6 +358,7 @@ Settings are merged in the following order: `groups`, `base`, `configs` (simple
357
358
358
359
- [x] **type**: **[Product Type](#product-type)** - Product type of the target
359
360
- [x] **platform**: **[Platform](#platform)** - Platform of the target
361
+
- [ ] **supportedDestinations**: **[[Supported Destinations](#supported-destinations)]** - List of supported platform destinations for the target.
360
362
- [ ] **deploymentTarget**: **String** - The deployment target (eg `9.2`). If this is not specified the value from the project set in [Options](#options)`.deploymentTarget.PLATFORM` will be used.
361
363
- [ ] **sources**: **[Sources](#sources)** - Source directories of the target
@@ -434,12 +436,15 @@ This will provide default build settings for a certain product type. It can be a
434
436
435
437
This will provide default build settings for a certain platform. It can be any of the following:
436
438
439
+
- `auto`(available only when we use `supportedDestinations`)
437
440
- `iOS`
438
-
- `macOS`
439
441
- `tvOS`
442
+
- `macOS`
440
443
- `watchOS`
441
444
- `visionOS`(`visionOS` doesn't support Carthage usage)
442
445
446
+
Note that when we use supported destinations with Xcode 14+ we can avoid the definition of platform that fallbacks to the `auto` value.
447
+
443
448
**Multi Platform targets**
444
449
445
450
You can also specify an array of platforms. This will generate a target for each platform.
@@ -470,6 +475,33 @@ targets:
470
475
471
476
The above will generate 2 targets named `MyFramework_iOS` and `MyFramework_tvOS`, with all the relevant platform build settings. They will both have a `PRODUCT_NAME` of `MyFramework`
472
477
478
+
### Supported Destinations
479
+
480
+
This will provide a mix of default build settings for the chosen platform destinations. It can be any of the following:
481
+
482
+
- `iOS`
483
+
- `tvOS`
484
+
- `macOS`
485
+
- `macCatalyst`
486
+
- `visionOS`
487
+
488
+
```yaml
489
+
targets:
490
+
MyFramework:
491
+
type: framework
492
+
supportedDestinations: [iOS, tvOS]
493
+
deploymentTarget:
494
+
iOS: 9.0
495
+
tvOS: 10.0
496
+
sources:
497
+
- path: MySources
498
+
inferDestinationFiltersByPath: true
499
+
- path: OtherSources
500
+
destinationFilters: [iOS]
501
+
```
502
+
503
+
Note that the definition of supported destinations can be applied to every type of bundle making everything more easy to manage (app targets, unit tests, UI tests etc).
504
+
473
505
### Sources
474
506
475
507
Specifies the source directories for a target. This can either be a single source or a list of sources. Applicable source files, resources, headers, and `.lproj` files will be parsed appropriately.
@@ -484,7 +516,9 @@ A source can be provided via a string (the path) or an object of the form:
484
516
- [ ] **compilerFlags**: **[String]** or **String** - A list of compilerFlags to add to files under this specific path provided as a list or a space delimited string. Defaults to empty.
485
517
- [ ] **excludes**: **[String]** - A list of [global patterns](https://en.wikipedia.org/wiki/Glob_(programming)) representing the files to exclude. These rules are relative to `path` and _not the directory where `project.yml` resides_. XcodeGen uses Bash 4's Glob behaviors where globstar (**) is enabled.
486
518
- [ ] **includes**: **[String]** - A list of global patterns in the same format as `excludes` representing the files to include. These rules are relative to `path` and _not the directory where `project.yml` resides_. If **excludes** is present and file conflicts with **includes**, **excludes** will override the **includes** behavior.
487
-
- [ ] **createIntermediateGroups**: **Bool** - This overrides the value in [Options](#options)
519
+
- [ ] **destinationFilters**: **[[Supported Destinations](#supported-destinations)]** - List of supported platform destinations the files should filter to. Defaults to all supported destinations.
520
+
- [ ] **inferDestinationFiltersByPath**: **Bool** - This is a convenience filter that helps you to filter the files if their paths match these patterns `**/<supportedDestination>/*` or `*_<supportedDestination>.swift`. Note, if you use `destinationFilters` this flag will be ignored.
521
+
- [ ] **createIntermediateGroups**: **Bool** - This overrides the value in [Options](#options).
- [ ] **buildPhase**: **String** - This manually sets the build phase this file or files in this directory will be added to, otherwise XcodeGen will guess based on the file extension. Note that `Info.plist` files will never be added to any build phases, no matter what this setting is. Possible values are:
490
524
- `sources` - Compile Sources phase
@@ -520,9 +554,11 @@ targets:
520
554
MyTarget:
521
555
sources: MyTargetSource
522
556
MyOtherTarget:
557
+
supportedDestinations: [iOS, tvOS]
523
558
sources:
524
559
- MyOtherTargetSource1
525
560
- path: MyOtherTargetSource2
561
+
inferDestinationFiltersByPath: true
526
562
name: MyNewName
527
563
excludes:
528
564
- "ios/*.[mh]"
@@ -534,6 +570,7 @@ targets:
534
570
- "-Werror"
535
571
- "-Wextra"
536
572
- path: MyOtherTargetSource3
573
+
destinationFilters: [iOS]
537
574
compilerFlags: "-Werror -Wextra"
538
575
- path: ModuleMaps
539
576
buildPhase:
@@ -561,10 +598,11 @@ A dependency can be one of a 6 types:
561
598
562
599
- [ ] **embed**: **Bool** - Whether to embed the dependency. Defaults to true for application target and false for non application targets.
563
600
- [ ] **link**: **Bool** - Whether to link the dependency. Defaults to `true` depending on the type of the dependency and the type of the target (e.g. static libraries will only link to executables by default).
564
-
- [ ] **codeSign**: **Bool** - Whether the `codeSignOnCopy` setting is applied when embedding framework. Defaults to true
565
-
- [ ] **removeHeaders**: **Bool** - Whether the `removeHeadersOnCopy` setting is applied when embedding the framework. Defaults to true
566
-
- [ ] **weak**: **Bool** - Whether the `Weak` setting is applied when linking the framework. Defaults to false
567
-
- [ ] **platformFilter**: **String** - This field is specific to Mac Catalyst. It corresponds to the "Platforms" dropdown in the Frameworks & Libraries section of Target settings in Xcode. Available options are: **iOS**, **macOS** and **all**. Defaults is **all**
601
+
- [ ] **codeSign**: **Bool** - Whether the `codeSignOnCopy` setting is applied when embedding framework. Defaults to true.
602
+
- [ ] **removeHeaders**: **Bool** - Whether the `removeHeadersOnCopy` setting is applied when embedding the framework. Defaults to true.
603
+
- [ ] **weak**: **Bool** - Whether the `Weak` setting is applied when linking the framework. Defaults to false.
604
+
- [ ] **platformFilter**: **String** - This field is specific to Mac Catalyst. It corresponds to the "Platforms" dropdown in the Frameworks & Libraries section of Target settings in Xcode. Available options are: **iOS**, **macOS** and **all**. Defaults is **all**.
605
+
- [ ] **destinationFilters**: **[[Supported Destinations](#supported-destinations)]** - List of supported platform destinations this dependency should filter to. Defaults to all supported destinations.
568
606
- [ ] **platforms**: **[[Platform](#platform)]** - List of platforms this dependency should apply to. Defaults to all applicable platforms.
569
607
- **copy** - Copy Files Phase for this dependency. This only applies when `embed` is true. Must be specified as an object with the following fields:
570
608
- [x] **destination**: **String** - Destination of the Copy Files phase. This can be one of the following values:
@@ -614,13 +652,17 @@ projectReferences:
614
652
path: path/to/FooLib.xcodeproj
615
653
targets:
616
654
MyTarget:
655
+
supportedDestinations: [iOS, tvOS]
617
656
dependencies:
618
657
- target: MyFramework
658
+
destinationFilters: [iOS]
619
659
- target: FooLib/FooTarget
620
660
- framework: path/to/framework.framework
661
+
destinationFilters: [tvOS]
621
662
- carthage: Result
622
663
findFrameworks: false
623
664
linkType: static
665
+
destinationFilters: [iOS]
624
666
- sdk: Contacts.framework
625
667
- sdk: libc++.tbd
626
668
- sdk: libz.dylib
@@ -646,7 +688,8 @@ targets:
646
688
```
647
689
648
690
**Package dependency**
649
-
- [ ] **product**: **String** - The product to use from the package. This defaults to the package name, so is only required if a Package has multiple libraries or a library with a differing name
691
+
- [ ] **product**: **String** - The product to use from the package. This defaults to the package name, so is only required if a Package has multiple libraries or a library with a differing name. Use this over `products` when you want to define different linking options per product.
692
+
- [ ] **products**: **String** - A list of products to use from the package. This can be used when depending on multiple products from a package.
650
693
651
694
```yaml
652
695
packages:
@@ -664,6 +707,21 @@ targets:
664
707
product: SPMUtility
665
708
```
666
709
710
+
Depending on multiple products from a package:
711
+
712
+
```yaml
713
+
packages:
714
+
FooFeature:
715
+
path: Packages/FooFeature
716
+
targets:
717
+
App:
718
+
dependencies:
719
+
- package: FooFeature
720
+
products:
721
+
- FooDomain
722
+
- FooUI
723
+
```
724
+
667
725
### Config Files
668
726
669
727
Specifies `.xcconfig` files for each configuration.
0 commit comments