frederik_diamond on Nostr: **Switching to Observation framework worked** I’m surprised to say it, but ...
**Switching to Observation framework worked**
I’m surprised to say it, but converting my code from using ObservableObject to the newer Observation framework that Apple released fixed the problem I had with the view rerendering.
I did read that the Observation framework had improvements made to rerendering, as it will only rerender the views that actually need to be rerendered, but I didn’t know it would work just immediately without making any significant changes to the codebase. So now, the rotation animation for the chevron is working and it looks great.
It would be nice to have an animation where the contents of a folder will slide down when expanding the folder. And likewise, when collapsing a folder, the contents should slide up. #dev #swift
I’m surprised to say it, but converting my code from using ObservableObject to the newer Observation framework that Apple released fixed the problem I had with the view rerendering.
I did read that the Observation framework had improvements made to rerendering, as it will only rerender the views that actually need to be rerendered, but I didn’t know it would work just immediately without making any significant changes to the codebase. So now, the rotation animation for the chevron is working and it looks great.
It would be nice to have an animation where the contents of a folder will slide down when expanding the folder. And likewise, when collapsing a folder, the contents should slide up. #dev #swift
quoting note1wmn…r44v**SwiftUI rerendering issue**
I thought that my implementation of the ‘Files’ view in the sidebar of my Swift app was pretty solid. It does work, but it is rerendering the view each time I collapse and expand folders. This means, I cannot add an animation for the chevron when it rotates. Even though it’s a small detail, I still find it pretty annoying. Looking into how can implement the functionality in a way where Swift does not rerender the view like it’s doing now.
I will try to use the Observation framework instead of ObservableObject. Let's see if that gives me a better result. #dev #Swift #macOS