From 1a1ec1208de51bf1a931066b728701b59e5e0282 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Fri, 30 Dec 2016 18:38:07 -0800 Subject: [PATCH] Added getAllTargets() --- lib/pbxProject.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 6468a83..e8a6693 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1706,6 +1706,29 @@ pbxProject.prototype.getFirstTarget = function() { } } +//Returns an array of objects containing the uuid and target +pbxProject.prototype.getAllTargets = function() { + //Holds all target json information + var targets = []; + + //Get raw target info + var targetUuids = this.getFirstProject()['firstProject']['targets']; + + //for each target index + for (const uuid of targetUuids) { + var uuidValue = uuid.value; + var target = this.pbxNativeTargetSection()[uuidValue]; + + targets.push({ + uuid: uuidValue, + target: target + }); + } + + return targets; + +} + /*** NEW ***/ pbxProject.prototype.addToPbxGroupType = function (file, groupKey, groupType) {