Attach modal to Sketch document
✓ Published0🌍 Public
KKevinGutowski
Last edited Jun 14, 2020
Created on Jun 14, 2020
This example shows how to attach a modal alert dialog to the active Sketch document window using the Sketch scripting API. It creates an `NSAlert` with OK and Cancel buttons and presents it as a sheet via `beginSheetModalForWindow:completionHandler:`. The completion handler uses a block created with `__mocha__.createBlock_function` to process the return code, logging success or cancelation. The code manages asynchronous execution through `coscript.createFiber()` and cleans up the fiber after the dialog closes.
AI-generated description