Skip to content

Commit ea7e0f4

Browse files
authored
Merge pull request #11 from yokomotod/feature/addToDict
addToDict
2 parents 65365e6 + be75019 commit ea7e0f4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Sources/PBXObject.swift

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ public class PBXContainerItemProxy : PBXContainerItem {
9898
public lazy var proxyType: String = self.string("proxyType")!
9999
public lazy var remoteGlobalIDString: PBXProject = self.object("remoteGlobalIDString")
100100
public lazy var remoteInfo: String = self.string("remoteInfo")!
101+
102+
override func toDictionary() -> JsonObject {
103+
return [
104+
"containerPortal": self.containerPortal.toDictionary(),
105+
"proxyType": self.proxyType,
106+
"remoteGlobalIDString": self.remoteGlobalIDString.toDictionary(),
107+
"remoteInfo": self.remoteInfo
108+
]
109+
}
101110
}
102111

103112
public /* abstract */ class PBXProjectItem : PBXContainerItem {
@@ -168,6 +177,13 @@ public class PBXBuildStyle : PBXProjectItem {
168177
public class XCBuildConfiguration : PBXBuildStyle {
169178
public lazy var name: String = self.string("name")!
170179
public lazy var buildSettings: [String: Any] = self.dictionary("buildSettings")!
180+
181+
override public func toDictionary() -> JsonObject {
182+
return [
183+
"name": self.name,
184+
"shellScript": self.buildSettings
185+
]
186+
}
171187
}
172188

173189
public /* abstract */ class PBXTarget : PBXProjectItem {
@@ -194,17 +210,40 @@ public class PBXNativeTarget : PBXTarget {
194210
public lazy var dependencies: [PBXTargetDependency] = self.objects("dependencies")
195211
public lazy var productReference: [PBXFileReference] = self.objects("productReference")
196212
public lazy var productType: String = self.string("productType")!
213+
214+
override public func toDictionary() -> JsonObject {
215+
return[
216+
"dependencies": self.dependencies.map { $0.toDictionary() },
217+
"productReference": self.productReference.map { $0.toDictionary() },
218+
"productType": self.productType
219+
]
220+
}
197221
}
198222

199223
public class PBXTargetDependency : PBXProjectItem {
200224
public lazy var target: PBXNativeTarget = self.object("target")
201225
public lazy var targetProxy: PBXContainerItemProxy = self.object("targetProxy")
226+
227+
override public func toDictionary() -> JsonObject {
228+
return[
229+
"target": self.target.toDictionary(),
230+
"targetProxy": self.targetProxy.toDictionary()
231+
]
232+
}
202233
}
203234

204235
public class XCConfigurationList : PBXProjectItem {
205236
public lazy var buildConfigurations: [XCBuildConfiguration] = self.objects("buildConfigurations")
206237
public lazy var defaultConfigurationIsVisible: Bool = self.bool("defaultConfigurationIsVisible")!
207238
public lazy var defaultConfigurationName: String = self.string("defaultConfigurationName")!
239+
240+
override public func toDictionary() -> JsonObject {
241+
return[
242+
"buildConfigurations": self.buildConfigurations.map { $0.toDictionary() },
243+
"defaultConfigurationIsVisible": self.defaultConfigurationIsVisible,
244+
"defaultConfigurationName": self.defaultConfigurationName
245+
]
246+
}
208247
}
209248

210249
public class PBXReference : PBXContainerItem {

0 commit comments

Comments
 (0)