xtool.git
Publicgit clone https://git.maproj.org/xtool.gitxtool.git / Sources / XcodeProjects / XCSchema+PBXProj.swift
XCSchema+PBXProj.swift17 lines · 610 BRaw
| 1 | import Foundation |
| 2 | private import XcodeProj |
| 3 | |
| 4 | extension XCSchema.Project { |
| 5 | public func pbxprojRepresentation(name: String) throws -> Data { |
| 6 | let xcprojData = try self.jsonRepresentation() |
| 7 | let pbxproj = try PBXProj(xcprojData: xcprojData, projectName: name) |
| 8 | // dataRepresentation should never return nil |
| 9 | return try pbxproj.dataRepresentation() ?? Data() |
| 10 | } |
| 11 | |
| 12 | public init(pbxprojRepresentation data: Data) throws { |
| 13 | let pbxproj = try PBXProj(data: data) |
| 14 | let xcprojData = try pbxproj.xcprojData() |
| 15 | try self.init(jsonRepresentation: xcprojData) |
| 16 | } |
| 17 | } |