From 905dde991b6e779bdd0ce8f1b23e0d5212c06a01 Mon Sep 17 00:00:00 2001 From: Geoffrey Foster Date: Fri, 5 Jan 2018 00:56:15 -0500 Subject: [PATCH] fix adding groups recursively --- .../Objects+Extensions/PBXGroup+FolderSync.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/XcodeProject/Objects+Extensions/PBXGroup+FolderSync.swift b/Sources/XcodeProject/Objects+Extensions/PBXGroup+FolderSync.swift index 7edcd31..9976b7c 100644 --- a/Sources/XcodeProject/Objects+Extensions/PBXGroup+FolderSync.swift +++ b/Sources/XcodeProject/Objects+Extensions/PBXGroup+FolderSync.swift @@ -32,6 +32,7 @@ public extension PBXGroup { return fileReference } + @discardableResult func addGroup(pathComponent: String) -> PBXGroup { let group = PBXGroup(globalID: PBXObject.ID(), name: nil, path: pathComponent, sourceTree: .group) children.append(group) @@ -107,11 +108,10 @@ public extension PBXGroup { if recursive { let directories = missing.filter { $0.hasDirectoryPath } - let groups = directories.map { + directories.forEach { addGroup(pathComponent: $0.lastPathComponent) } - - groups.forEach { + children.flatMap { $0 as? PBXGroup }.forEach { $0.addMissingFiles(recursive: recursive, target: target) } }