Getting the files your app stores on the device back out so you can look at them for debugging or similar is not as easy as it could be. There’s a number of filebrowser libraries out there, but it’s a bit overkill or occasional use and probrably not something you want to ship with your app either. Here’s how to create a zip file from any directory and move it off the device using the share sheet (UIActivityViewController).
I wrote this in a hurry, so there’s lots of force unwrapping. Fine for development, but if you intend to ship this, make sure you deal with potential errors properly.
Workarounds are a fact of life for programmers. You rarely have the ability to fix all the buggy code you have to work with, and even if you do, it might not be worth the time and effort to find and validate a proper fix. But while a workaround allows you to move forward quickly, it also creates a maintenance burden. Creative solutions like this are usually more fragile and will need to be revisited occasionally. Here are a few ways you can use the compiler to help remind you.
About me
My name is Robin Kunde. I am a software engineering consultant currently specializing in iOS mobile development and the Swift compiler. I have worked on large e-commerce projects and mobile apps for major retailers in the past.