Comments (4)
Hello @rayfarer ,
Thank you for your feedback. You are right, the Getting Started guide is not up-to-date at the moment.
We are about to release a significant update for InstantSearch
with lots of new helpers and the Guide will be updated accordingly.
Stay tuned!
from instantsearch-ios.
Hi @rayfarer,
Well done, this is exactly what we expect from developers as HitsController
protocol implementation 🙂
We sunset HitsTableController
implementation because it required the inheritance for customization. The protocol-based approach is just a bit more complicated, but is way more flexible. That's why we encourage developers to use it within long-term projects. But we might provide more implementation guides for sure.
By the way, we have a repository containing the examples of search features implementations using InstantSearch. You can take a look at it to get inspiration for your own projects.
from instantsearch-ios.
I see that these were marked as "Obsolete old table/collection view helpers." I guess it would just be helpful if the Getting Start guide was updated, because it still uses these obsolete components.
from instantsearch-ios.
I'm happy to hear the guide will be updated soon. I guess I'm just a little discouraged because the obsolete HitsTableController is now preventing my app from building. Do you have any suggestions to work around this?
Edit
After a little thought, I implemented my own Table Controller like the hint suggested, using the Demos as my guide. Still working out the kinks, but I think this is a better solution than in v5. Thanks again for all your work. If I can help with the documentation, I'd be happy to.
Here's what I did:
- Created a file called ResultsTableViewController.swift. Made sure it conformed to the HitsController protocol.
- Declared a table controller according to the user guides:
let hitsTableController = ResultsTableViewController()
Example ResultsTableViewController.swift
import Foundation
import InstantSearch
import UIKit
class ResultsTableViewController: UITableViewController, HitsController {
var hitsSource: HitsInteractor<Hit>?
let cellID = "collectioncell"
override func viewDidLoad() {
super.viewDidLoad()
tableView.register(CollectionCell.self, forCellReuseIdentifier: cellID)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return hitsSource?.numberOfHits() ?? 0
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath) as? CollectionCell else {
return .init()
}
// Get hit data and assign it to stuff in your cell
let hit = hitsSource?.hit(atIndex: indexPath.row)
let artist = hit?.artist
let year = hit?.year
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// If you select a hit, logic to handle that goes here.
let hit = hitsSource?.hit(atIndex: indexPath.row)
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// Controls height of hit cell
return 120
}
}
from instantsearch-ios.
Related Issues (20)
- InstantSearch iOS Numeric Range Iteractor/Connector not refreshing when searcher search changed HOT 1
- Infinite requests when using LazyVGrid on MacOS HOT 3
- Not able to set log level HOT 2
- Recommendation like Get Trending Global Items in iOS
- Add custom JSONDecoder property to HitsInteractor HOT 2
- Pagination for HitsController not working sometimes in iOS HOT 3
- Incorrect facet selected attribute value on Hierarchical filter HOT 1
- Incorrect number of hits on HitsInteractor when using pagination (infinitescroll) HOT 4
- Wrong issue
- Add the possibility to map the index data model to a custom data model when fetching hits HOT 2
- Empty queries conditional display not working in HitsObservableController
- SwiftUI: Setting automaticallyShowsCancelButton HOT 1
- Reporting a vulnerability
- Sequence extension with `sorted(by:)` function should be internal HOT 1
- The app references non-public selectors `didToggleSwitch` and `didSelectSegment` warning when uploading to AppStore Connect HOT 1
- Can't disable Insights HOT 2
- Not able to pass dynamic attribute to FacetList Connector ?
- Xcode warnings for InstantSearchInsights
- EXC_BAD_ACCESS (code=1, address=0xf69aa6f6bd70) in HOT 1
- HitsObservableController not clearing out old results after applying filter HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instantsearch-ios.