I have an array of named tuples.
And I would like to apply a filter on this array depending the value of an element of my array of tuples
typealias Section = (sectionName : String, sectionInputs : [Input])
var defaultSectionsData : [Section]
var found = sectionsData.filter($0.sectionName == myString)
But I've this error:
Anonymous closure argument not contained in a closure.
Any suggestion ?
A closure must be defined between brackets:
var found = sectionsData.filter({$0.sectionName == myString})
// or equivalently
var found = sectionsData.filter {$0.sectionName == myString}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With