Posts

Post not yet marked as solved
1 Replies
0 Views
Yes its possible! Its kinda complicated though. To access the external Files storage area the user has to be shown a sheet to grant access to a folder. But once granted a security scoped bookmark can be saved locally (in UserDefaults or a local file) so that folder can be accessed again without bugging the user. It took me awhile to work the whole process out and I tried to wrap it up in easy to use load and save Buttons. It had to be some kind of view to have a place to show the sheet. Anyways my implementation is working well but it’s designed to read and write to only one specific file in the selected folder with Codable objects. Thats’s something I plan to refactor but looking over the code it can give you the idea, or at least the keywords to lookup and see what the necessary parts are. See it here https://github.com/trochoid/EZIO There’s a ButtonSave and ButtonLoad view with the relevant code but they also call static functions in the EZIO class. Documentation is basically missing and, um, the error handling is atrocious embarrassed. That’s the other part I plan to refactor, please look passed it to how it otherwise works and I can answer questions.
Post not yet marked as solved
3 Replies
0 Views
I just went through this section and didn’t have any problems. The color picker appeared and worked as expected in both preview and running. This is on iPad. What exactly is happening? Is running never starting the app?
Post not yet marked as solved
4 Replies
0 Views
Just an update… I’ve reinstalled and it still crashes unfortunately. Command-/ is safe to toggle commenting code though, just have to be careful to never ever edit after a //. So I’m working very carefully like that: only code, /**/, Command-/, and still had a couple crashes unrelated to this comment bug. At least I never noticed an accidental // edit. Anyways 4.1 has been really buggy for me and I hope 4.2 brings back my jewel. Or maybe my device is just too old 🤷🏻‍♀️
Post not yet marked as solved
4 Replies
0 Views
Thanks Quinn, good thing I’m a procrastinator and haven’t tried to reinstall yet 😊. I just sent a Bug report (FB10034623) and will backup and reinstall in a day or 2. If I only write code and use /**/ style comments then it doesn’t crash so have been plunking along like that lol.
Post not yet marked as solved
2 Replies
0 Views
The “App” type project creates a .swiftpm file, this is what you want. “Playground” projects creates a “.playgroundbook” file, these are legacy, you don’t want it. “Xcode Playground” I don’t know, I don’t have that option. Maybe its a .swiftpm file 🤷‍♀️. Look in the Files app under iCloud Drive > Playgrounds to see your project files.
Post not yet marked as solved
2 Replies
0 Views
Look in the Files app in iCloud Drive > Playgrounds and you will see all your projects as .swiftpm files. If what you mean is you’re seeing the files as .playgroundBook then you’re using the wrong project type, its the “App” projects that create .swiftpm files. Also what do you mean by ‘run a Swift Playground book inside a Swift Playground app’, what do you want to do with this?
Post not yet marked as solved
1 Replies
0 Views
Yes, I have this problem too but with the 4.0.2 update it’s gotten better, at least it feels it happens less often, usually warnings, and I haven’t needed to reboot the device to get it unstuck (relaunching app is enough). When it does get stuck I’ll do one or both of these things in either order Intentionally add a space to break code around where it’s stuck then delete the space. This triggers the compiler to start working again and hopeful clears the hang up. With the preview/Canvas panel open, at the top it says “App Preview”. Tap on that show show a menu and choose “Restart” or “Delete Data and Restart”. This will get the compiler to try again. If neither of those work (usually happens with a warning about a variable that’s no longer in my code) then I have to restart Playgrounds and that’s always rectified things since 4.0.2. You can also send feedback that this needs improving (open a project, tap top-right circle icon with 3 dots inside, select “Send Feedback” from menu). I don’t understand the technical problem with it getting stuck but a button to force a more complete recompilation I think would help.
Post marked as solved
1 Replies
0 Views
Does this help… let encoder = JSONEncoder()     encoder.outputFormatting = .prettyPrinted     do {         let data = try encoder.encode(user) //convert user to json data here         print(String(data: data, encoding: .utf8)!) //print to console     } catch {         print("fail")     }
Post not yet marked as solved
1 Replies
0 Views
This is hacky but maybe you could check the size of your root view since running is full screen and the previews are inset.
Post not yet marked as solved
2 Replies
0 Views
I have a copy of that but don’t know how to share it. It looks like I’d have to email it or through Discord. This forum isn’t letting me select the project file to attach here.