Frontend Tools
Templates & Starters
Ecommerce Starter
Starter for product search powered by Algolia InstantSearch
- angular
INSTALL
1let package = Package( 2 dependencies: [ 3 .package(url: "https://github.com/algolia/algoliasearch-client-swift", from: "8.0.0") 4 ], 5 // ... 6)
INDEX
1struct Contact: Encodable { 2 let objectID: ObjectID 3 let firstname: String 4 let lastname: String 5} 6 7let contacts: [Contact] = [ 8 .init(objectID: "myID1", firstname: "Jimmie", lastname: "Barninger"), 9 .init(objectID: "myID2", firstname: "Warren", lastname: "Speach"), 10] 11 12let replacements = contacts.map {($0.objectID, $0) } 13 14index.replaceObjects(replacements: replacements) { result in 15 if case .success(let response) = result { 16 print("Response: \(response)") 17 } 18}
SEARCH
1let index = client.index(withName: "contacts") 2index.search(query: "s") { result in 3 if case .success(let response) = result { 4 print("Response: \(response)") 5 } 6} 7 8var query = Query("s") 9query.attributesToRetrieve = ["firstname", "lastname"] 10query.hitsPerPage = 50 11index.search(query: query) { result in 12 if case .success(let response) = result { 13 print("Response: \(response)") 14 } 15}
Starter for product search powered by Algolia InstantSearch
Typeahead dropdown playground built with the Algolia Autocomplete library
Starter for video search powered by Algolia InstantSearch