I just see I removed a linefeed in the code when pasting code, making
allQuotes.append(newOutput)
appear on the same line, which would then be in the comment, hence not executed !
Also : var not needed for newOutput ; let newOutput will do the job.
Here is the properly formatted code.
typealias MyDict = [String: String] // A dictionary is defined as [key:Value]
var quotes: [MyDict] {
var allQuotes = [MyDict]() // Creates an empty array
for i in 1...4 {
let newOutput = ["testID" : "testName \(i)", "secondID" : "secondName \(i)"] // a dict with 2 pairs
allQuotes.append(newOutput) // We append the new output to the array of Dicts // <<-- on its own line
}
return allQuotes
}
print(quotes)
Topic:
Programming Languages
SubTopic:
Swift