Xcode 12 beta 6 has changed the SwiftUI FileDocument
protocol and broke my tests.
#1
Comments
Posted this on the Apple Dev Forums: |
Same problem here. ¯\(ツ)/¯ |
I've worked around the issue for now, but still looking for a long term solution. Also asked on these forums to no avail as of yet: |
Any luck with the issue? Without this functionality, not only is it impossible to test my code, but impossible for me to create a code my view using SwiftUI. I was hoping to construct a ReadConfiguration by passing it a path or a file URL so I can pass it to my document object. This sucks! I'm an Apple fanboy coming from the world of .NET C#. So far in my short journey learning Swift, this is the biggest snag I've encountered thus far. Microsoft gets everything wrong, including developer tools and languages, but if you look hard enough, you'll eventually find an answer. I've looked through Apples documentation and it's actually worse than Microsoft's. Many of the functions have no example code snippets and many of the descriptions are one liners. This doesn't bode well for me. It sours my high expectations of excellence from Apple. Maybe I should wait for Microsoft's upcoming MAUI. |
@Joebeazelman So sorry to hear this is blocking you. I am not actively doing any Apple development. This issue is from an older proof of concept project I did for a friend. I'm not in a place to give you any guidance. So sorry. |
Thanks. No problem. At least I know it can't be resolved. |
Ran across your questions in All The Places™ and thought I'd respond as it was a challenge I ran into as well, and others will too. The dead simple workaround (which, doh, should have realized) is just to provide an initial value for the document in the view's variable. (You can wrap that in #if DEBUG if that makes sense for your context and provide a different alternative for non-DEBUG.) Obviously not an ideal thing as it doesn't flex the API at the point it needs, but it at least is a point one can get past. Plus it works with previews. |
Seems the updates to
FileDocument
have changed the requiredinit
andwrite
calls to something like:ReadConfiguration
is atypealias
ofFileDocumentReadConfiguration
This looks like a public struct:
BUT in my tests I used to make fixture instances of
PeopleDocument
with:I tried to convert this to match the changes but not seeing how to make a
FileDocumentConfiguration
Also have tried:
Ideas?
The text was updated successfully, but these errors were encountered: