Show iOS System Dictionary Screen

How to show the iOS system dictionary word lookup screen programmatically

Show iOS System Dictionary Screen

iOS includes a built-in dictionary that can be shown to the user programmatically using UIReferenceLibraryViewController. This allows you to show word definitions directly in your app.

Using UIReferenceLibraryViewController

The UIReferenceLibraryViewController is simple to use, but also very limited.
Initialize it with a term to look up, then present the UIViewController:

import UIKit

// Check if dictionary is available for the word
let term = "serendipity"
let dictionaryAvailable = UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: term)

if dictionaryAvailable {
    print("Has definition in one of the currently downloaded dictionaries")
}
else {
    print("Does not have a definition in one of the currently downloaded dictionaries")
}

// Create and present the dictionary view controller
let dictionaryViewController = UIReferenceLibraryViewController(term: term)
self.present(dictionaryViewController, animated: true, completion: nil)

Even if there is no definition available, presenting the UIReferenceLibraryViewController anyway is a good idea.
If the user has no dictionaries downloaded, there will be no definition found for any word. However, the presented UIReferenceLibraryViewController will show the user an option to download a dictionary file.

All Dictionaries Definition