Save Data from Swift Playgrounds App (Mac)

How do you save data from a Swift Playgrounds App on the Mac? I get an error 'playgroundSharedDataDirectory is not supported in Swift Playgrounds'

I think it's doable, some of the Swift Playgrounds tutorials remember the pages I've completed.

This is with Playgrounds 4.5.1 on a Mac mini M2 Pro running OSX 14.7 (Sonoma)

Ideally, I'd like to save multiple 'documents' and allow the user to select which one they want to work with. The documents don't need to be visible to other Apps.

Thanks in advance

Save Data from Swift Playgrounds App (Mac)
 
 
Q