Rearranging the coding a bit (moved coding into a function), it crashes now with this stack (see screenshot). Which leaves me clueless as well ;-).
Post
Replies
Boosts
Views
Activity
If your data is local, then using CoreData might be an option. Then you'd have only one model.
If your data resides on a remote server/database, then you'd have a local (Swift)UI model, plus the remote data model. In that case you'd need to write the code to manage loading the proper data from remote into your local UI model. Here you have to be careful, that the remote data is the "source of truth", not the data in your local UI model. One way to handle this would be to only update the remote data model and then load/update the UI model (and never modify the UI model other than from the remote model).
@Claude31 it works with or without the private keyword. My initial question was regarding the correctness of the documentation. I am accessing a @State property outside of a view's body, whereas the documentation states:
only access a state property from inside the view’s body Cheers, Michael
@Claude31
The coding works just fine. My question was, if either the coding is not correct (while working fine) or the documentation is probably not correct (or at least unclear).
As for your question regarding my usage of private. Here's the whole paragraph from the documentation - https://developer.apple.com/documentation/swiftui/state (emphasis added).
You should only access a state property from inside the view’s body, or from methods called by it. For this reason, declare your state properties as private, to prevent clients of your view from accessing them. It is safe to mutate state properties from any thread. Cheers.
Hi,
it seems @FocusedBinding and @FocusedValue can be used for that, though I have not tried it yet. Please see here, where it is discussed: https://developer.apple.com/forums/thread/651748 . (The last entry there by "Frameworks Engineer")
Cheers, Michael
Just stumbled across a similar, probably the same issue. Items in an HStack, in a ScrollView. Does not scroll at all...
Have you filed a feedback already, so I can reference it in my Feedback?
This seems to be related to issues myself and several others are facing. I asked (here: https://developer.apple.com/forums/thread/662553), if anybody has received any official update on that issue, yet. So far it seems nobody did.
Frankly I find it worrying, that something quite fundamentally breaks in a new, but not beta framework and it's three month without a fix or at least getting any info (workaround, or even a "hey, we know it's a bug") from Apple. Any communication on this would not only help to get applications working which were finde in iOS13, but also help to decide, if other issues we are seeing (like animations not working anymore in some cases) are related or something new. So far I haven't received any feedback on the feedback I filed (FB8714689). At least I now see that there are "more than 10" similar reports - it seems we're building a community here ;-).
And, to end on on a positive note: So far feedback for SwiftUI I gave, was definitely handled way better/faster, than any other feedback I gave.
Still not working in Xcode 12 Beta 2 :-(
I have encountered pretty much the same issue: https://developer.apple.com/forums/thread/660976
Filed as: FB8714689
Now logged as FB8714689.
I think I just ran into the a same issue: https://developer.apple.com/forums/thread/660976
So it seems the issue is still in Xcode 12 and Xcode 12.2 beta.
(This should be a reply to the answer from mjcotr. But for some reason the reply does not seem to work as expected.)
Thank you, that looks exactly like what I was looking for. I haven't had heard about @NSApplicationDelegateAdaptor before.
I'll give it a try!
Thanks, Michael
Hi,
has anybody figured out in the meantime the why's and when's (James original questions)?
I am currently trying to develop a macOS app with SwiftUI's new app lifecycle and a document package as persistence and am really struggling to find out what the best approach here is...
Thanks!
Bookmarks! That was the hint I needed :-)So far testing looks good: Both the good and the problematic SD cards were identified correctly.Thanks for the help, Quinn! I'll make sure to have the proper coding in place, for cases when the approach with the bookmarks fails horribly.Cheers, Michael
If coling the volume means, that the content is cloned as well, then that could be fine for my use case (well actually there might be edge cases where it would not). So let me explain why I want to do it:Essentially what I am trying to do (on an abstract level), is to write an application which catalogues files, which may or may not be stored on external drives. Some metadata of those files would be stored locally in an import step and also available if the external drive is not connected. If the user needs to access the original file, the application should be able to detect if the proper drive and thus the file (if not deleted, etc.) is available or not.On a not so abstract level: Think of cataloging photos from SD cards from the same camera. Using the SD cards basically as film rolls, meaning never overwriting them. If the original photo needs to be retrieved, the SD card may be plugged in, is automatically detected and the file can be retrieved.Not sure if my explanation is good enough, though. ;-)Thanks, Michael