Access iOS dictionary programmatically

I’m looking for a way to access iOS dictionary programmatically. What I need is to retrieve the list of the words of a particular language from inside a custom app.
Is it possible? Are there any API that provide this (or similar) functionality?
I’ve checked Apple documentation but didn’t find anything useful…May someone point me to the right direction?

  • Custom UIFont baseline shifted
  • FMDB query isn't acting right with LIKE
  • Container View made in Storyboard will not change frame programmatically
  • Screenshot in swift iOS?
  • Get the current displaying UIViewController on the screen in AppDelegate.m
  • Animating the width of UISearchBar frame
  • 7 Solutions Collect From Internet About “Access iOS dictionary programmatically”

    I don’t think there is a public API to access the embedded Dictionary. The closest is using UITextChecker but that may not satisfy your needs

    As an alternative, you could find and embed a Word Dictionary in the Language you want? It may require some extra work

    There is an API for bringing up the built-in dictionary UI (not the original question but raised in some of the responses), including checking for whether a given word is defined:

    if ([UIReferenceLibraryViewController dictionaryHasDefinitionForTerm:@"word"]) {
        UIReferenceLibraryViewController* ref = 
            [[UIReferenceLibraryViewController alloc] initWithTerm:@"word"];
        [currentViewController presentViewController:ref animated:YES completion:nil];
    }
    

    There is no API, but if all you need is a list of words you can read it from /usr/share/dict/words:

        NSString *allTheWords = [NSString stringWithContentsOfFile: @"/usr/share/dict/words"
                                                          encoding: NSUTF8StringEncoding
                                                             error: nil];
        for (NSString *line in [allTheWords componentsSeparatedByString:@"\n"]) {
            NSLog(@"%@",line);
        }
    

    If you need an arbitrary list of words you can get it from several online resources, here is one. The README at /usr/share/dict/README says iOS word list uses ftp://ftp.ox.ac.uk/pub/wordlists

    For instant search you’ll need to load the words on a structure suitable for prefix search, like a trie. Here is a sample project where I did just that.

    If you need a dictionary, get one online, then include a pointer to the word entry in the trie node. If loading takes too much time you can experiment loading on the background, or compressing, or serializing the trie.

    There is no API to do what you are asking.

    I ran into a similar problem a long time ago and did what other people suggested: embedded an English dictionary inside my app. Since then I’ve turned my solution into a static library which is available at http://www.lexicontext.com (note that it costs a few bucks). Considering the number of developers who downloaded it, this seems to be a common problem…

    Even there is no API, it can be used automatically if user long-press the selected word.

    If you can use the private API you can use the following code to define a word:

    _UIDictionaryManager *manager = [%c(_UIDictionaryManager) assetManager];
    id definitions = [manager _definitionValuesForTerm:[self queryString]];
    for(_UIDefinitionValue *item in definitions) {
            myModel = self;
            NSMutableAttributedString *def = [item definition];
            NSString *str = [def string];
            HBLogDebug(@"%@ = %@", [item localizedDictionaryName], str);
    }