Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Data representation for Writable #787

Merged
merged 6 commits into from
Aug 30, 2023
Merged
Changes from 4 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
8 changes: 6 additions & 2 deletions Sources/XcodeProj/Objects/Project/PBXProj.swift
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,15 @@ extension PBXProj: Writable {
}

public func write(path: Path, override: Bool, outputSettings: PBXOutputSettings) throws {
let encoder = PBXProjEncoder(outputSettings: outputSettings)
let output = try encoder.encode(proj: self)
let output = try encodeAsString(outputSettings: outputSettings)
if override, path.exists {
try path.delete()
}
try path.write(output)
}

public func encodeAsString(outputSettings: PBXOutputSettings) throws -> String {
let encoder = PBXProjEncoder(outputSettings: outputSettings)
return try encoder.encode(proj: self)
}
}