Search code examples
xcodeuikitmac-catalyst

Catalyst: UIReferenceLibraryViewController missing in UIKit?


In my iOS app I use UIReferenceLibraryViewController (UIKit) to lookup words in the dictionary. Works fine. When building for Catalyst I get:

Showing Recent Issues
Undefined symbol: _OBJC_CLASS_$_UIReferenceLibraryViewController

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_UIReferenceLibraryViewController", referenced from:
      objc-class-ref in WoordvinderViewController.o
      objc-class-ref in AnagramViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Is UIReferenceLibraryViewController just missing from the UIKit framework, or am I missing something?

Apple's code level support tells me to report a bug... eh.. feedback in the bug reporter, but the bug report goes unacknowledged. Xcode 12 beta did not fix it, nor did Xcode 12 release.


Solution

  • The class is not implemented for Catalyst yet despite the docs saying it's supported. I even checked the macOS port of UIKit at /System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework/Versions/A/UIKitCore and found no reference to the class.

    I guess the only solution, for now, is to create a macOS plugin that shows the native lookup popover by calling NSView.showDefinition().