I have the list of following model class
struct CommonRes {
var month: String?
var monthName: String?
var year: String?
var classIdCount: String?
var groupName: String?
}
var res = [CommonRes]()
In the response I am receiving the duplicate values of monthName. I want to make the list of these common monthName by removing duplicates. So from this I have tried the following
self.monthList = Array(Set(res.filter({ (i : CommonRes) in res.filter({ $0.monthName == i.monthName }).count > 1 })))
But I am receiving an error
Ambiguous reference to member 'filter'