itemSelectionHandler using extended SearchTextFieldItem class
DavidCollinsNZ opened this issue · 1 comments
DavidCollinsNZ commented
Hi,
I've extended the SearchTextFieldItem class to mySearchTextFieldItem.
But when i use the itemSelectionHandler my added variables aren't available. Only the standard ones. Title, Subtitle, and image.
Has anyone else been able to solve this?
The filtered results are still of class SearchTextFieldItem
`class MySearchTextFieldItem: SearchTextFieldItem {
public var userId: Int?
public init(title: String, subtitle: String?, userId:Int){
super.init(title: title)
self.title = title
self.subtitle = subtitle
self.userId = userId
}
}
`
DavidCollinsNZ commented
Ah, I just figured it out! Casting
let item = filteredResults[itemPosition] as! MySearchTextFieldItem