apasccon/SearchTextField

itemSelectionHandler using extended SearchTextFieldItem class

DavidCollinsNZ opened this issue · 1 comments

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
}

}
`

Ah, I just figured it out! Casting

let item = filteredResults[itemPosition] as! MySearchTextFieldItem