Skip to content

Instantly share code, notes, and snippets.

@chbeer
Created August 15, 2022 13:15
Show Gist options
  • Save chbeer/1d20049793667c4cc1fd27f3ef747414 to your computer and use it in GitHub Desktop.
Save chbeer/1d20049793667c4cc1fd27f3ef747414 to your computer and use it in GitHub Desktop.
Hack for fixing a crash in Catalyst when using UIDocumentBrowserViewController
// This uses https://github.com/steipete/InterposeKit.git
// I added this code to func application(_, didFinishLaunchingWithOptions:) -> Bool
if let clazz = NSClassFromString("NSTouchBarView") {
do {
let _ = try Interpose(clazz) {
try $0.hook("layout",
methodSignature: (@convention(c) (AnyObject, Selector) -> Void).self,
hookSignature: (@convention(block) (AnyObject) -> Void).self) {
store in { `self` in }
}
}
} catch {
print("Unable to interpose")
}
}
@chbeer
Copy link
Author

chbeer commented May 10, 2023

Fixes [<NSView …> valueForUndefinedKey:]: this class is not key value coding-compliant for the key cell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment