Skip to content

Commit a20ed24

Browse files
committed
exposing some conveniences for manipulating a build phase
1 parent 3b0da09 commit a20ed24

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

Sources/XcodeProject/Objects+Extensions/PBXReference+Extensions.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
import Foundation
1010

1111
public extension PBXReference {
12+
var parentGroup: PBXGroup? {
13+
return parent as? PBXGroup
14+
}
15+
}
16+
1217
public extension PBXReference {
1318
var url: URL? {
1419
guard let sourceTree = sourceTree else { return nil }

Sources/XcodeProject/Objects/Build Phases/PBXBuildPhase.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,19 @@ public class PBXBuildPhase: PBXObject {
2424
var runOnlyForDeploymentPostprocessing: Bool?
2525
var buildActionMask: Int32 = Int32.max
2626

27-
func remove(file: PBXBuildFile) {
27+
public func insert(contentsOf buildFiles: [PBXBuildFile], at index: Int) {
28+
files.insert(contentsOf: buildFiles, at: index)
29+
}
30+
31+
public func remove(file: PBXBuildFile) {
2832
guard let index = files.index(of: file) else { return }
2933
files.remove(at: index)
3034
}
3135

36+
public func remove(at index: Int) {
37+
files.remove(at: index)
38+
}
39+
3240
override func willMove(from: PBXObject?) {
3341
super.willMove(from: from)
3442
files.forEach {

0 commit comments

Comments
 (0)