XUtils

InstantSearch iOS

A library of widgets and helpers to build instant-search features on iOS.


Examples

You can see InstantSearch iOS in action in the Examples project. It contains search components ans experiences built with InstantSearch and written in Swift.

Swift Package Manager

The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. Since the release of Swift 5 and Xcode 11, SPM is compatible with the iOS, macOS and tvOS build systems for creating apps.

To use SwiftPM, you should use Xcode 11 to open your project. Click File -> Swift Packages -> Add Package Dependency, enter InstantSearch repo’s URL. Next, select the products you consider to use in your project from the provided list.

If you’re a framework author and use InstantSearch as a dependency, update your Package.swift file:

let package = Package(
    // 7.26.0 ..< 8.0.0
    dependencies: [
        .package(url: "https://github.com/algolia/instantsearch-ios", from: "7.26.0")
    ],
    // ...
)

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

To install InstantSearch, simply add the following line to your Podfile:

pod 'InstantSearch', '~> 7.26'
# pod 'InstantSearch/Insights' for access to Insights library only
# pod 'InstantSearch/Core' for access business logic without UIKit components
# pod 'InstantSearch/SwiftUI' for access to SwiftUI components

Then, run the following command:

$ pod update

Carthage

Carthage is a simple, decentralized dependency manager for Cocoa.

  • To install InstantSearch, simply add the following line to your Cartfile:
github "algolia/instantsearch-ios" ~> 7.26
  • Launch the following commands from the project directory
    
    carthage update
    ./Carthage/Checkouts/instant-search-ios/carthage-prebuild
    carthage build
    

NOTE: At this time, Carthage does not provide a way to build only specific repository subcomponents (or equivalent of CocoaPods’s subspecs). All components and their dependencies will be built with the above command. However, you don’t need to copy frameworks you aren’t using into your project. For instance, if you aren’t using UI components from InstantSearch, feel free to delete that framework from the Carthage Build directory after carthage update completes keeping only InstantSearchCore. If you only need event-tracking functionalities, delete all but InstantSearchInsights framework.

If this is your first time using Carthage in the project, you’ll need to go through some additional steps as explained over at Carthage.

Documentation

You can start with the Getting Started Guide.

Learn more about instantSearch iOS in the dedicated documentation website.

Logs

There are 7 levels of logs severity produced by the library. The default severity level is .info. You can configure the logging level as follows:

Logs.logSeverityLevel = .debug

Telemetry

InstantSearch iOS collects data points at runtime. This helps the InstantSearch team improve and prioritize future development.

Here’s an exhaustive list of the collected data:

  • InstantSearch version
  • The name of the instantiated InstantSearch components, for example, HitsSearcher, FilterState
  • The name of the components with custom parameters (overridden defaults). InstantSearch doesn’t collect the values of those parameters. For example, the default of the facets value in FacetListInteractor is an empty list. If you instantiate it with a list of facets, then the telemetry tracks that the facets parameter received a custom value, but not the value itself.

InstantSearch doesn’t collect any sensitive or personal data. However, you can still opt out of the telemetry collection with the following code:

 InstantSearchTelemetry.shared.isEnabled = false

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you use InstantSearch in your app, we would love to hear about it! Drop us a line on discourse or twitter.

Articles

  • coming soon...