Skip to content

Commit 6c566c3

Browse files
authored
Fixed Contents.json formatting (#231)
Closes #225
1 parent a4ce5c1 commit 6c566c3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Sources/XcodeExport/Model/XcodeExportExtensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extension XcodeAssetContents {
4949

5050
func makeFileContents(to directory: URL) throws -> FileContents {
5151
let encoder = JSONEncoder()
52-
encoder.outputFormatting = .prettyPrinted
52+
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
5353

5454
let data = try encoder.encode(self)
5555
let fileURL = URL(string: "Contents.json")!

Sources/XcodeExport/XcodeColorExporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ final public class XcodeColorExporter: XcodeExporterBase {
219219

220220
private func makeXcodeAssetFileContents(contents: XcodeAssetContents, directory: URL) throws -> FileContents {
221221
let encoder = JSONEncoder()
222-
encoder.outputFormatting = .prettyPrinted
222+
encoder.outputFormatting = [.prettyPrinted, .sortedKeys]
223223
let data = try encoder.encode(contents)
224224
let fileURL = URL(string: "Contents.json")!
225225
return FileContents(

Tests/XcodeExportTests/XcodeIconsExporterTests.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -667,17 +667,17 @@ final class XcodeIconsExporterTests: XCTestCase {
667667
{
668668
"images" : [
669669
{
670-
"idiom" : "universal",
671-
"filename" : "ic24TabBarHome.pdf"
670+
"filename" : "ic24TabBarHome.pdf",
671+
"idiom" : "universal"
672672
}
673673
],
674674
"info" : {
675-
"version" : 1,
676-
"author" : "xcode"
675+
"author" : "xcode",
676+
"version" : 1
677677
},
678678
"properties" : {
679-
"template-rendering-intent" : "template",
680-
"preserves-vector-representation" : true
679+
"preserves-vector-representation" : true,
680+
"template-rendering-intent" : "template"
681681
}
682682
}
683683
"""
@@ -711,17 +711,17 @@ final class XcodeIconsExporterTests: XCTestCase {
711711
{
712712
"images" : [
713713
{
714-
"idiom" : "universal",
715-
"filename" : "ic24TabBarHome.pdf"
714+
"filename" : "ic24TabBarHome.pdf",
715+
"idiom" : "universal"
716716
}
717717
],
718718
"info" : {
719-
"version" : 1,
720-
"author" : "xcode"
719+
"author" : "xcode",
720+
"version" : 1
721721
},
722722
"properties" : {
723-
"template-rendering-intent" : "template",
724-
"preserves-vector-representation" : true
723+
"preserves-vector-representation" : true,
724+
"template-rendering-intent" : "template"
725725
}
726726
}
727727
"""

0 commit comments

Comments
 (0)