这个问题几乎概括了一切。我检查了很多不同的单词,但没有一个返回 true。这是我的代码:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("accessed")
print(words[indexPath.row])
if UIReferenceLibraryViewController.dictionaryHasDefinition(forTerm: words[indexPath.row]) {
print("in")
let ref: UIReferenceLibraryViewController = UIReferenceLibraryViewController(term: words[indexPath.row])
self.present(ref, animated: true, completion: nil)
}
}
我正在尝试显示给定单词的定义。任何帮助,将不胜感激。谢谢!
您是否在模拟器或设备中安装了词典(牛津词典或其他词典)?如果你没有,你需要。