Skip to content

Commit 9d682af

Browse files
committed
adding Frameworks removal
1 parent d09c261 commit 9d682af

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

lib/pbxProject.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ pbxProject.prototype.addFramework = function (path, opt) {
155155
return file;
156156
}
157157

158+
pbxProject.prototype.removeFramework = function (path, opt) {
159+
var file = new pbxFile(path, opt);
160+
161+
this.removeFromPbxBuildFileSection(file); // PBXBuildFile
162+
this.removeFromPbxFileReferenceSection(file); // PBXFileReference
163+
this.removeFromFrameworksPbxGroup(file); // PBXGroup
164+
this.removeFromPbxFrameworksBuildPhase(file); // PBXFrameworksBuildPhase
165+
166+
return file;
167+
}
168+
158169
// helper addition functions
159170
pbxProject.prototype.addToPbxBuildFileSection = function (file) {
160171
var commentKey = f("%s_comment", file.uuid);
@@ -224,6 +235,18 @@ pbxProject.prototype.addToFrameworksPbxGroup = function (file) {
224235
pluginsGroup.children.push(pbxGroupChild(file));
225236
}
226237

238+
pbxProject.prototype.removeFromFrameworksPbxGroup = function (file) {
239+
var pluginsGroupChildren = this.pbxGroupByName('Frameworks').children;
240+
241+
for(i in pluginsGroupChildren) {
242+
if(pbxGroupChild(file).value == pluginsGroupChildren[i].value &&
243+
pbxGroupChild(file).comment == pluginsGroupChildren[i].comment) {
244+
pluginsGroupChildren.splice(i, 1);
245+
break;
246+
}
247+
}
248+
}
249+
227250
pbxProject.prototype.addToPbxSourcesBuildPhase = function (file) {
228251
var sources = this.pbxSourcesBuildPhaseObj();
229252
sources.files.push(pbxBuildPhaseObj(file));
@@ -264,7 +287,7 @@ pbxProject.prototype.removeFromPbxFrameworksBuildPhase = function (file) {
264287
var sources = this.pbxFrameworksBuildPhaseObj();
265288
for(i in sources.files) {
266289
if(sources.files[i].comment = longComment(file)) {
267-
delete sources.files[i];
290+
sources.files.splice(i, 1);
268291
break;
269292
}
270293
}

0 commit comments

Comments
 (0)