Async network download
✓ Published0🌍 Public
KKevinGutowski
Last edited Mar 24, 2021
Created on Mar 24, 2021
This example demonstrates asynchronous network downloading within Sketch, fetching a remote sketch file from a GitHub URL. It shows how a document is downloaded and then opened programmatically, with the resulting native Sketch document logged to the console. The code uses the Sketch JavaScript API, including `sketch/async` to create a fiber for managing the operation, and `NSURLSession` with `downloadTaskWithURL:completionHandler:` to perform the download. Upon completion, a completion block reads the downloaded file into an `MSDocument`, error handling is included, and the fiber is cleaned up after processing.
AI-generated description