I’m attempting to cross a worth represented as a dictionary for launchArguments with a purpose to run UI Exams.
So, I’ve tried to transform the dictionary to a String format and cross it like that:
let dic = ["Key1": "Value1", "Key2": "Value2"]
do {
let information = strive JSONEncoder().encode(dic)
if let worth = String(information: information, encoding: .utf8) {
launchArguments += [ "-launchKey", value ]
}
} catch {
print("Error encoding launchArguments: (error.localizedDescription)")
}
When the app begins, it would not add a dictionary to UserDefaults. It would not give any data as nicely. What is likely to be an issue?