Add ability to sort local Packages group#1366
Closed
mthole wants to merge 1 commit into
Closed
Conversation
mthole
commented
Jun 21, 2023
Comment on lines
+590
to
+591
| if group.name == "Packages", | ||
| let packagesOrdering = project.options.groupOrdering.first(where: { $0.pattern == "Packages" }) { |
Contributor
Author
There was a problem hiding this comment.
This is a bit fragile-- other suggestions welcome!
Contributor
There was a problem hiding this comment.
Another option could be to treat any folder as "group" for the purposes of sorting in setupGroupOrdering with something like this:
public func setupGroupOrdering(group: PBXGroup) {
let groupOrdering = project.options.groupOrdering.first { groupOrdering in
// existing logic ...
}
func isGroupOrFolder(_ element: PBXFileElement) -> Bool {
element is PBXGroup || (element as? PBXFileReference)?.lastKnownFileType == "folder"
}
if let order = groupOrdering?.order {
let files = group.children.filter { !isGroupOrFolder($0) }
var groups = group.children.filter { isGroupOrFolder($0) }
// existing logic ...
Owner
|
Closed in favour of #1466 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In my team's project, we primarily use the local SPM packages organized into "layers", with a directional dependency graph. In such a set up, it's super helpful to have the ordering of the layers in the Xcode organizer reflect the logical ordering of the layers. This PR adds that functionality, expanding the
groupOrderingconfiguration to be applied to the local package ordering as well.