anyone could please help me figure this out? I am new to Swift and sqlite.
I am passing this string to a function
let compositionstring = "iris, magenta, iris";
Where I convert it to an array with
let compositionArr = string.components(separatedBy: ",")
Then I am expecting the following code to query a database and print the path, filename, and category for each in compositionstring.
do {
try compositionArr.forEach {
print($0)
for var files in try db.prepare(files.select(path, name, category).filter(category.like($0)).limit(1)) {
print("path: \(files[path]), filename: \(files[name]), category: \(files[category])")
}
}
But I only get the first result, and nothing after.
iris
path: file://localhost/Volumes/IWL%20Jen%20Vid/IWL%20Captions/Material_Sonia/Sonia%202019/IWL%20videos/Mexico/Palacio%20belle%20arte/IMG_7762.MOV, filename: IMG_7762.MOV, category: Iris
magenta
iris
There must be something very basic I am missing. Thank you for your help!