I need to replicate a plist but the keys contain spaces.
For example
Key= button type, Type= String, Value= action
I recreated the plist and saved the data in the same format but not sure how to get the space in the key. The same plist need to go from the software to the app hence the reason why it needs the same format.
I usually write my keys like below and save them into my plist
var buttonType: String = "action"
Below is how it looks when saved in the plist
Key= buttonType, Type= String, Value= action
How would I approach saving a plist which contains keys with spaces? Could someone point me in the right direction please? Thanks.
UPDATE - Extra code used in the plist
Saving plist
func saveData() {
let dataFilePath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("\(fileName).plist")
let encoder = PropertyListEncoder()
do {
let data = try encoder.encode(markUpPlist)
try data.write(to: dataFilePath!)
print("Saved")
} catch {
print("Error Encoding \(error)")
}
}
MarkUpPlist
class MarkUpPlist: Codable {
var UUIDlogger: UUID = UUID()
var arrayObjects: [Marker] = []
var backgroundColor: String = ""
var lastSaved: Date = Date()
var loggerName: String = ""
var total: Int = 0
}
Marker
class Marker: Codable {
var UUIDpic: UUID = UUID()
var alpha: Int = 1
var buttonType: String = "action"
}