Skip to content

Commit d74c819

Browse files
committed
expose target as a sync option
1 parent 495a734 commit d74c819

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Sources/XcodeProject/Objects+Extensions/PBXGroup+FolderSync.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public extension PBXGroup {
3838
return group
3939
}
4040

41-
func sync(recursive: Bool) {
42-
addMissingFiles(recursive: recursive)
41+
func sync(recursive: Bool, target: PBXTarget? = nil) {
42+
let target = target ?? parentProject?.targets.first
43+
addMissingFiles(recursive: recursive, target: target)
4344
removeMissingFiles(recursive: recursive)
4445
}
4546

@@ -80,10 +81,9 @@ public extension PBXGroup {
8081
children = newChildren
8182
}
8283

83-
private func addMissingFiles(recursive: Bool, target: PBXTarget? = nil) {
84+
private func addMissingFiles(recursive: Bool, target: PBXTarget?) {
8485
guard let url = self.url else { return }
8586
print("Adding missing file: \(url)")
86-
let target = target ?? parentProject?.targets.first
8787
let childPathItems: [(String, PBXReference)] = children.flatMap {
8888
guard let childURL = $0.url else { return nil }
8989
return (childURL.path, $0)

0 commit comments

Comments
 (0)