๐ A collection of partial JNA bindings for various macOS frameworks. (e.g. Foundation, AppKit, etc.)
These are just some common examples, for a wider range, check out our tests.
Creating an NSString
var str = new NSString("Hello, World!");
// You can access this as a Java String if you wish too! (NSString#getJvmString)
Creating an NSURL
var str = new NSURL("https://cbyrne.dev");
// You can access this as a Java URL if you wish too! (NSURL#getJvmURL)
Copying text to the clipboard
var pasteboard = NSPasteboard.generalPasteboard();
pasteboard.clearContents();
pasteboard.setString("Hello, World!", NSPasteboard.TypeString);
Opening a file picker (NSOpenPanel)
var panel = NSOpenPanel.openPanel();
panel.setCanChooseFiles(true);
var result = panel.runModal();
if(result == NSAlert.NSModalResponse.OK) {
NSURL url = panel.getURLs().objectAtIndex(0); // Can also use firstObject()
System.out.println("First URL: " + url);
}