You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let sourcesBuildPhase = try target.sourcesBuildPhase()
_ = try sourcesBuildPhase?.add(file: file)
That works fine when I add a file to a target first time. But for files which already added to the target this code add them again.
What 🌱
func add(file: PBXFileElement) throws -> PBXBuildFile {
if let existing = files.first(where: { $0.fileReference == reference }) {
return existing
}
let projectObjects = try objects()
let buildFile = PBXBuildFile(file: file)
projectObjects.add(object: buildFile)
files.append(buildFile)
return buildFile
}
I think that first line of this method has a typing error. I've changed it to if let existing = files.first(where: { $0.fileReference == file.reference })
and it works correctly now.
If this is a new issue I can push a fix.
The text was updated successfully, but these errors were encountered:
Context 🕵️♀️
My code:
That works fine when I add a file to a target first time. But for files which already added to the target this code add them again.
What 🌱
I think that first line of this method has a typing error. I've changed it to
if let existing = files.first(where: { $0.fileReference == file.reference })
and it works correctly now.
If this is a new issue I can push a fix.
The text was updated successfully, but these errors were encountered: