An object displaying localized text in search results related to your app.


class CSLocalizedString : NSString


The CSLocalizedString class helps you localize text in searchable items. You can use a CSLocalizedString object in place of an NSString object to display localized text in search results related to your app.

For example, you might use the following code to define a CSLocalizedString object for a searchable item you want to identify as “Song” in English:

CSSearchableItem *item = [CSSearchableItem new];
    item.uniqueIdentifier = @"song";
    CSSearchableItemAttributeSet *attributes = [[CSSearchableItemAttributeSet alloc] initWithItemContentType:(NSString *)kUTTypeItem];
    item.attributeSet = attributes;
    CSLocalizedString *displayName = [[CSLocalizedString alloc] initWithLocalizedStrings:@{@"en":@"Song", @"fr":@"Chanson"}];
    attributes.displayName = displayName.localizedString;


Specifying Localized Strings

init(localizedStrings: [AnyHashable : Any])

Initializes a CSLocalizedString object with the specified dictionary of localized strings.

Getting a Localized String

func localizedString() -> String

Returns the localized string for the current language.

See Also


class CSSearchQuery

The criteria to apply when searching previously indexed app content.

class CSPerson

An object representing a person in the context of search results.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software