I have a custom array like this
let moreMenuItem = [MoreMenuItem(title: "number1", imageName: "rate"),
MoreMenuItem(title: "number2", imageName: "followFacebook"),
MoreMenuItem(title: "number3", imageName: "email")]
and this is my model class
class MoreMenuItem {
var title: String?
var imageName: String?
init(title: String, imageName: String) {
self.title = title
self.imageName = imageName }
}
}
now let say I have a string "number3" and I would like to check if my array has "number3" in title. If it does, return the index where number3 is found. Any suggestions?