Skip to content

Trouble Serializing Custom Objects From Search Response #873

Closed
@Broich

Description

@Broich

Hello there,

I upgraded the Algolia Swift client to 9.9.1 and I'm having trouble understanding how I serialize response hits into my custom objects.

Previously, I was able to do something like this:

index?.search(query: query) { [weak self] result in
    switch result {
    case .failure(let error):
        self?.logger.error("Error returning search results: \(error)")
    case .success(let response):
        do {
            let results: [MyLocalObject] = try response.extractHits()
            self?.results = results
            DispatchQueue.main.async {
                self?.tableView.reloadData()
            }
        } catch let error {
            self?.logger.error("error: \(error)")
        }
    }
}

But extractHits seems to be gone now and I couldn't find a place in the documentation that would explain if and what it was replaced by.

I'm assuming I'm missing something super obvious.

Thanks for your help and support.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions