Skip to content

RamblerSpotlight is easy way to setup CoreSpotlight in your app.

License

Notifications You must be signed in to change notification settings

strongself/RamblerSpotlight

Repository files navigation

Overview

RamblerSpotlight is easy way to setup CoreSpotlight in your app.

Version License Test Coverage Status

Key Features
🚀 Provides all the infrastructure for using objects in Spotlight.
Keeps Spotlight data up to date.
💾 Saves data that needs index later.
📲 Battle-tested into several Rambler&Co projects.

Installation

# Latest release of RamblerSpotlight
pod 'RamblerSpotlight'

Development target: ios 9.0 or later

Usage

For full information clone the example project

Before using read our article on Habrahabr.ru

  1. Create SpotlightEntityObject for your entity.

You need to create next classes:

@interface NameEntityChangeProviderFetchRequestFactory : NSObject <ChangeProviderFetchRequestFactory> 
...

@interface NameEntityObjectIndexer : ObjectIndexerBase
...

@interface NameEntityObjectTransformer : NSObject <ObjectTransformer>
...

After that create SpotlightEntityObject:

SpotlightEntityObject *spotlightEntity = [SpotlightEntityObject entityObjectWithObjectTransformer:objectTransformer
                                                                                       requestFactory:requestFactory
                                                                                        objectIndexer:objectIndexer];
  1. Create RamblerSpotlight's object
RamblerSpotlight *ramblerSpotlight = [[RamblerSpotlight alloc] init];
  1. Setup RamblerSpotlight with entities, your app's context and CSSearchableIndex
NSArray<SpotlightEntityObject *> *entitiesObjects = @[...];
NSManagedObjectContext *context ... ;
CSSearchableIndex *searchableIndex =  [CSSearchableIndex defaultContext];

[ramblerSpotlight setupSpotlightWithSpotlightEntitiesObjects:entitiesObjects
                                                  appContext:context
                                             searchableIndex:searchableIndex];
  1. Start monitoring for changes to your objects in CoreData
[ramblerSpotlight startMonitoring];

Author

Links

https://habrahabr.ru/company/rambler-co/blog/268257/

License

RamblerSpotlight is available under the MIT license. Copyright (c) 2016 StrongSelf community

See the LICENSE file for more info.

About

RamblerSpotlight is easy way to setup CoreSpotlight in your app.

Resources

License

Stars

Watchers

Forks

Packages

No packages published