Skip to content

Commit c4f20ff

Browse files
authored
Merge pull request #106 from smartmobilefactory/feature/STRMAC-1858
Plist2swift: Make sure to sort allKeyValueTuples to ensure consistent ordering
2 parents 05a279c + 8101d89 commit c4f20ff

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Plist2swift/Sources/Plist2.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private func isKeyAvailableInAllPlists(keyToSearch: String, tupleKey: String, tu
109109
return true
110110
}
111111

112-
private func generateProtocol(tuplesForPlists: [String: KeyValueTuples], allKeyValueTuples: [String: KeyValueTuples]) -> [String: [String: String]] {
112+
private func generateProtocol(tuplesForPlists: [String: KeyValueTuples], allKeyValueTuples: [(String, KeyValueTuples)]) -> [String: [String: String]] {
113113
var dictionaryWithOptionalValues = [String: [String: String]]()
114114
for (tupleKey, tuples) in allKeyValueTuples {
115115

@@ -659,6 +659,7 @@ for plistPath in plists {
659659
}
660660
}
661661

662-
let optionalDictionary = generateProtocol(tuplesForPlists: tuplesForPlists, allKeyValueTuples: allKeyValueTuples)
662+
let allKeyValueTuplesSorted = allKeyValueTuples.sorted(by: { $0.0 < $1.0 })
663+
let optionalDictionary = generateProtocol(tuplesForPlists: tuplesForPlists, allKeyValueTuples: allKeyValueTuplesSorted)
663664
generateProtocol(name: protocolName, commonKeys: commonKeys, oddKeys: oddKeys, keysAndTypes: keysAndTypes)
664665
generateEnum(name: enumName, protocolName: protocolName, allTuples: allTuples, keysAndTypes: keysAndTypes, oddKeys: oddKeys, optionalDictionary: optionalDictionary)

0 commit comments

Comments
 (0)