Latest 0.1.4
Homepage https://github.com/renatosarro/SpotlightHandler
License MIT
Platforms ios 7.0, requires ARC
Authors

A simple way to index your application making it visible on Spotlight Search

0.1.4 Update

Define what App icon will be used in index search. If pass "nil", the search will be indexed with icon named "AppIcon"

Pod

Podfile

pod "SpotlightHandler"

Terminal

pod install

Usage

The first step is to make your ViewController a subclass of BaseIndexableViewController like shown below:

#import "BaseIndexableViewController.h"

@interface ViewController : BaseIndexableViewController

@end

That way, the Spotlight settings are already visible in the Interface Builder
alt tag
#
Then just fill the fields in the way that you prefer

alt tag
#
(Don’t forgot to turn on the Spot Indexable field) =)

AppDelegate

Finally, let’s add a method in our AppDelegate class, that will be responsible by identify the Spotlight’s action and show the selected controller

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler
{
    if ([userActivity.activityType isEqualToString:CSSearchableItemActionType]) {
        NSString *uniqueIdentifier = userActivity.userInfo[CSSearchableItemActivityIdentifier];

        [SpotlightHandler openController:uniqueIdentifier];
    }

    return YES;
}

Latest podspec

{
    "name": "SpotlightHandler",
    "version": "0.1.4",
    "summary": "A simple way to index your application",
    "description": "A simple way to index your application making it visible on Spotlight Search",
    "homepage": "https://github.com/renatosarro/SpotlightHandler",
    "license": {
        "type": "MIT",
        "file": "LICENSE.txt"
    },
    "authors": {
        "Renato Matos": "[email protected]"
    },
    "source": {
        "git": "https://github.com/renatosarro/SpotlightHandler.git",
        "tag": "0.1.4"
    },
    "social_media_url": "https://twitter.com/rmatos_",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/SpotlightUtils/**/**/*.{h,m}",
    "resource_bundles": {
        "SpotlightHandler": [
            "Pod/Assets/*.png"
        ]
    },
    "public_header_files": "Pod/SpotlightUtils/**/**/*.h"
}

Pin It on Pinterest

Share This