Stanislav Chernischuk
Stanislav Chernischuk

Reputation: 985

What does the dark triangle, located on the folder icons in Xcode 9, mean?

I use Xcode 9.0. Some folders icons in my Xcode project have dark triangles in bottom left corner - for example, "0. Login", "Frameworks", "Products", "Pods". What does this mean?

Image with dark triangles on folders icons

Upvotes: 43

Views: 4382

Answers (2)

marc-medley
marc-medley

Reputation: 9832

The introduction of yellow folders with a triangle ( enter image description here ) in Xcode 9 coincides with the additional new feature which allows a Project Navigator Group to be directly associated with a file system directory.

The Xcode 9/10 yellow folders with a triangle ( enter image description here ) represents a Group not associated with a file system directory. Thus, an Xcode 9/10 yellow folder-with-a-triangle Group ( enter image description here ) is the same as an Xcode 8 plain yellow Group ( enter image description here ) …since prior to Xcode 9, Project Navigator Groups could not be expressly associated with a file system directory.

In Xcode 9/10, a file system directory association can be expressly added to or removed from a Project Nagivator Group with the File Inspector. The triangle will toggle on or off to indicate whether a file system association is present for the Group.

Click File Inspector folder icon to add a file system "Containing directory" association to a group:

enter image description here

Click the File Inspector Clear pathto remove a file system directory association from a group. Or, click the folder icon to change the file system "containing directory" association to a group:

enter image description here

The Xcode > File > New menu or Project Navigator context menu can add Groups in the following ways:

enter image description here

Note that the appearance of Group with Folder and Group without Folder is context sensitive.

enter image description here

  • New Group: creates an empty group of the same group type as the current uppermost selection in the Xcode Navigator. The opposing alternative of Group with Folder or Group without Folder will also appear on the same menu.
  • New with Group: ( enter image description here ) creates an empty group and creates an associated "containing" file system directory.
  • New Group without Folder: ( enter image description here ) creates a new empty group without any file system directory association.
  • New Group from Selection: creates a group of the same type at the current Xcode Navigator seletion.
    • context within a Group with Folder ( enter image description here ) creates an empty group and creates an associated "containing" file system directory AND moves the selected items into the newly created "containing" directory in the file system.
    • context within Group without Folder ( enter image description here ) creates an group which references the selection without creating any new folder in the file system.

Additionally, with the new Xcode 9 features, the drag and drop of a file system directory onto the project navigator will create Groups ( enter image description here ), and sub Groups ( enter image description here ), that are each associated with the corresponding original file system directory.

enter image description here

The Xcode 9 release notes notes that a Group with associated file system directory also have the following new beharviors:

  • Dragging files between groups in the Project Navigator moves the files in the filesystem and updates any associated SCM working copies.

  • When a group is connected to folder in the filesystem, creating, renaming, and deleting groups updates the corresponding files and folders in the the filesystem.

Addendum - Blue (Referenced) Folder

Blue referenced folders are useful for non-source-code assets which need to be copied into a target bundle during the build process.

When dragging an existing folder to Xcode, an option is provided "Create folder references" for the added folder.

enter image description here

"Create folder references" will create a blue folder in the project navigator. And, the contents of the folder will also be added. "SomeReferencedFolder" was added in the following Example.xcodeproject which contained ABC.pdf.

enter image description here

In this macOS Example application case, the referenced folder and the referenced folder content are copied into the Example.app bundle. The copy occurred as part of the build process since "Add to targets: Example" was checked.

enter image description here

Note: Xcode 9 & Xcode 10 groups behave the same.

Upvotes: 23

Mateusz
Mateusz

Reputation: 718

Folders without dark triangles exist as a group in your project and also (what is new in Xcode 9) exist as a folder in file structure.

Example: After double-click in your project navigator you can see menu:

enter image description here

For New Group Xcode create group in project navigator and create folder in file structure (in finder) and of cource for New Group without Folder create only group.

enter image description here

Upvotes: 38

Related Questions