---
title: "#23: Core Spotlight 🔍"
url: https://littlebitesofcocoa.com/23-core-spotlight
author: Jake Marsh
published: 2015-06-24
topics: ["Core Spotlight","iOS 9"]
description: "Core Spotlight allows your content to appear in the results of system-level Spotlight searches. Of course Core Spotlight is just one of many ways to get..."
---

# #23: Core Spotlight 🔍

By Jake Marsh, June 24, 2015. HTML: https://littlebitesofcocoa.com/23-core-spotlight

**[Core Spotlight](https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html)** allows your content to appear in the results of system-level Spotlight searches.

``` swift
let attrSet = CSSearchableItemAttributeSet(
  itemContentType: kUTTypeText as String
)

attrSet.title = "#23: CoreSpotlight"
attrSet.contentDescription = "CoreSpotlight allows your content to appear in the results of system-level Spotlight searches."

let item = CSSearchableItem(
  uniqueIdentifier: "023",
  domainIdentifier: "com.lilbitesofcocoa.bites",
  attributeSet: attrSet
)

CSSearchableIndex
  .defaultSearchableIndex()
  .indexSearchableItems([item]) { error in
    print("Success!")
  }
```

<img src="https://media.littlebitesofcocoa.com/bite-assets/023-corespotlight-example.png" style="max-width: 325px;" />

Of course **Core Spotlight** is just one of many ways to get your content into search results, be sure to also look into the [NSUserActivity APIs](https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-SW2) as well as [Apple's Web markup guides](https://developer.apple.com/library/prerelease/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS9.html#//apple_ref/doc/uid/TP40016198-SW4).
