Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Sources/XcodeProj/Workspace/XCWorkspaceData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ private extension XCWorkspaceDataElement {
self = try .file(XCWorkspaceDataFileRef(element: element))
case "Group":
self = try .group(XCWorkspaceDataGroup(element: element))
case "FileSystemSynchronizedGroup":
self = try .fileSystemSynchronizedGroup(XCWorkspaceDataGroup(element: element, elementName: "FileSystemSynchronizedGroup"))
default:
throw Error.unknownName(element.name)
}
Expand All @@ -81,6 +83,8 @@ private extension XCWorkspaceDataElement {
fileRef.xmlElement()
case let .group(group):
group.xmlElement()
case let .fileSystemSynchronizedGroup(group):
group.xmlElement(name: "FileSystemSynchronizedGroup")
}
}
}
Expand All @@ -93,8 +97,8 @@ private extension XCWorkspaceDataGroup {
case missingLocationAttribute
}

convenience init(element: AEXMLElement) throws {
guard element.name == "Group" else {
convenience init(element: AEXMLElement, elementName: String = "Group") throws {
guard element.name == elementName else {
throw Error.wrongElementName
}
guard let location = element.attributes["location"] else {
Expand All @@ -106,10 +110,10 @@ private extension XCWorkspaceDataGroup {
self.init(location: locationType, name: name, children: children)
}

func xmlElement() -> AEXMLElement {
func xmlElement(name: String = "Group") -> AEXMLElement {
var attributes = ["location": location.description]
attributes["name"] = name
let element = AEXMLElement(name: "Group", value: nil, attributes: attributes)
attributes["name"] = self.name
let element = AEXMLElement(name: name, value: nil, attributes: attributes)

_ = children
.map { $0.xmlElement() }
Expand Down
5 changes: 5 additions & 0 deletions Sources/XcodeProj/Workspace/XCWorkspaceDataElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public enum XCWorkspaceDataElement: Equatable {

case file(XCWorkspaceDataFileRef)
case group(XCWorkspaceDataGroup)
case fileSystemSynchronizedGroup(XCWorkspaceDataGroup)

/// Returns the location to the workspace data element.
public var location: XCWorkspaceDataElementLocationType {
Expand All @@ -15,6 +16,8 @@ public enum XCWorkspaceDataElement: Equatable {
ref.location
case let .group(ref):
ref.location
case let .fileSystemSynchronizedGroup(ref):
ref.location
}
}

Expand All @@ -26,6 +29,8 @@ public enum XCWorkspaceDataElement: Equatable {
lhs == rhs
case let (.group(lhs), .group(rhs)):
lhs == rhs
case let (.fileSystemSynchronizedGroup(lhs), .fileSystemSynchronizedGroup(rhs)):
lhs == rhs
default:
false
}
Expand Down