Skip to content

Commit

Permalink
Copy cachedGroup.children and write back only once
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed Sep 21, 2019
1 parent fa8c715 commit 0dc4a8d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/XcodeGenKit/SourceGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,14 @@ class SourceGenerator {
let groupReference: PBXGroup

if let cachedGroup = groupsByPath[path] {
var cachedGroupChildren = cachedGroup.children
for child in children {
// only add the children that aren't already in the cachedGroup
if !cachedGroup.children.contains(where: { $0.path == child.path }) {
cachedGroup.children.append(child)
if !cachedGroupChildren.contains(where: { $0.path == child.path }) {
cachedGroupChildren.append(child)
}
}
cachedGroup.children = cachedGroupChildren
groupReference = cachedGroup
} else {

Expand Down

0 comments on commit 0dc4a8d

Please sign in to comment.